1

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 �.

Lazlo
  • 8,518
  • 14
  • 77
  • 116
  • Are you 100% sure you are having a problem in the *database*? Are you sure the characters don't get broken when output on the web site, e.g. because of a database connection defaulting to ISO-8859-1? – Pekka Jul 11 '11 at 14:55
  • That's a possibility. I'm far from an encoding master. Could you post a fix as an answer instead of a comment? :) I'm using PHP. – Lazlo Jul 11 '11 at 14:58
  • Actually, since new input works fine, I'm really just looking for a conversion, not a change in the configuration. – Lazlo Jul 11 '11 at 14:59
  • See "black diamond" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James May 17 '23 at 21:39

2 Answers2

0

Had the same problems, but changing the sql connection to utf-8 helped :)

mysql_set_charset("utf-8", $mysql_link);
Daniel Ranft
  • 116
  • 1
  • 2
0

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?

Lazlo
  • 8,518
  • 14
  • 77
  • 116