Are there best practices for managing non-unicode searches in PHP while still utilizing a UTF8 table?

When managing non-unicode searches in PHP while utilizing a UTF8 table, it is important to properly handle character encoding to ensure accurate search results. One way to do this is by converting the search query to UTF-8 before executing the search query against the UTF-8 encoded database table.

// Convert the search query to UTF-8
$search_query = mb_convert_encoding($search_query, 'UTF-8');

// Execute the search query against the UTF-8 encoded table
$stmt = $pdo->prepare("SELECT * FROM table_name WHERE column_name LIKE :search_query");
$stmt->bindValue(':search_query', "%$search_query%", PDO::PARAM_STR);
$stmt->execute();
$results = $stmt->fetchAll();