UTF8 lithuanian characters unrecognized in MySQL database UTF8 lithuanian characters unrecognized in MySQL database wordpress wordpress

UTF8 lithuanian characters unrecognized in MySQL database


The problem you face has to do with a little specific detail in database character encoding settings and Wordpress.

While Wordpress has a general character encoding setting that normally takes care about database tables as well, it does not care about the default character encoding setting of the database those tables are in.

So when your plugin/code adds a database table your own, you need to take care about the encoding settings as well - because by default they will be the database default you create the table in, which most likely is latin-1 which does not work well for your language.

To set the default character set for the database (replace "wpdb" with your database name if it varies):

ALTER DATABASE wpdb CHARACTER SET utf8 COLLATE utf8_general_ci;

To change the character set for your existing table *"reg_form"*:

ALTER TABLE reg_form CONVERT TO CHARACTER SET charset_name;

Note: Backup your database first.


HOLLY SHIT!! FINALLY! : ))))))))

The problem was that I was using mysqli_ queries. Now I tried to change to mysql_ (notice the change!) queries and it worked!! Two weeks of haaaaard working and researches... Phew!

Now who can explain me properly the reasons of this phenomena? : ))