简体   繁体   中英

How to handle non-English characters extracting from MySQL database?

I am extracting text from a MySQL database table, collation is set to utf8_general_ci. In PHPMyAdmin, I can see the characters correctly:

"La consiglio fermamente anche perchè ho già acquistato iWrap per il mio:"

But when I extract it myself it prints out this way:

"La consiglio fermamente anche perch ho gi acquistato iWrap per il mio:"

How can I make the characters print correctly? Thanks!

  • Is your script utf8-encoded?
  • Is the browser displaying it as utf8?
  • Is your mysql connection's charset set to utf8?
  • Is phpmyadmin's connection's charset set to utf8?

You can check the first in your editor.
You can check the second one in your browser (also check the http headers it receives).
You can set a mysql connection to use utf8 with a simple SET NAMES 'utf8'; query.
Phpmyadmin's charset is displayed somewhere on it's index page.

尝试使用utf8_unicode而不是常规。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM