Search code examples
mysqlencodingutf-8ansi

Converting MySQL ANSI input to UTF-8


I've decided to switch my web app from ANSI to UTF-8. After converting the encoding of my hardcoded files in Notepad++ (which does a conversion, not only changing the character set) and setting a new meta tag for UTF-8, I now need to convert my database data.

This data has been inputted on ANSI forms, but is stocked as utf8_general_ci according to phpMyAdmin. Obviously I can't just change the MySQL stocking encoding then, because it's already the right one (apparently?).

On the web pages, my accent characters (é, à, etc.) loaded from the DB appear as �.


Solution

  • I think I found a solution from this blog:

    UPDATE `ressources` SET `title` = CONVERT(CONVERT(`title` USING binary) USING utf8);
    

    However, I get 0 rows affected on phpMyAdmin. Any idea why?