Issue with utf-8 encoding using PHP + MySQL

后端 未结 10 1550
谎友^
谎友^ 2020-12-16 12:41

I moved data from MySQL 4 (they were originally set to latin2 encoding) to MySQL 5 and set encoding to utf-8. It

10条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 13:09

    When you show UTF8 characters on a website but tell the browser to interpret them as Latin1 (or Latin2) you see this kind of gibberish: ß

    When you show Latin1 (or Latin2) characters on a website, but tell the browser to interpret them as UTF8, you see question marks.

    So my guess is that you switched everything to UTF8 (I mean, you told the DB Engine, the web server and the browser you would be using UTF8), but you didn't actually convert the strings to UTF8.

    Do what @Darkerstar said. Convert your dump to UTF8 (Notepad++ can do that easily) and import it again.

提交回复
热议问题