#201 Problem displaying correct encoding

3.3.3
closed-invalid
Jakub Vrána
MySQL (66)
5
2011-10-04
2011-10-04
rumburak24
No

I have found common problem for both phpmyadmin and adminer, both show incorrectly encoding of data that I have in my mysql database.

I already have solved the problem.

So I have utf8 encoding and database and tables set to utf8_czech_ci . My application works fine, but adminer does not show correct encoding.

I found that mysql command SET NAMES and/or php command
$this->set_charset("utf8");
overwrites collation by default values, which is Swedish. (I did not set Swedish, but Swedish is set as default language in mysql). So even I need to get Czech collation I got the Swedish one.

The solution for me was to escape line with
$this->set_charset("utf8");
and SET NAMES
and to insert there these lines:

$this->query("SET character_set_connection='utf8_czech_ci'");
$this->query("SET COLLATION_CONNECTION= 'utf8_czech_ci'");
$this->query("SET character_set_results='utf8_czech_ci'");

I think that using SET NAMES and/or set_charset("utf8"); is unlucky!

Discussion

  • Jakub Vrána
    Jakub Vrána
    2011-10-04

    • status: open --> closed-invalid
     
  • Jakub Vrána
    Jakub Vrána
    2011-10-04

    If Adminer shows wrong characters then it means that you have stored wrong characters in the database. Fix your application to call set_charset and convert your data. Maybe http://php.vrana.cz/prevod-kodovani-mysql.php can help you.