开发者

ext/mysql charset support vs ext/mysqli charset

开发者 https://www.devze.com 2022-12-17 17:14 出处:网络
I read some articles that promoted the use of the new ext/mysqli in php due to it\'s support of character sets. I currently use ext/mysql and use SET NAMES UTF-8 to ensure all my data is stored as utf

I read some articles that promoted the use of the new ext/mysqli in php due to it's support of character sets. I currently use ext/mysql and use SET NAMES UTF-8 to ensure all my data is stored as utf-8. isn't that charset support in ext/mysql or 开发者_运维问答am I missing something larger?

Thanks :)


SET NAMES UTF-8 does no mean the data are stored in UTF-8. That means that data is RECIEVED in UTF-8 from client and is SERVED in UTF-8 to client.

Storage encoding is set when you create a db/table/row, for example

CREATE TABLE{
  ...
}CHARSET=utf8;

or

 CREATE DATABASE  DEFAULT CHARACTER SET utf8

Read here: Mysql: latin1-> utf8. Convert characters to their multibyte equivalents


2 Lyon mysql goes just fine.

Please check once more the encodings of the tables and rows via, for example, phpMyAdmin. Remember that setting encoding to database doesn't automatically change the encoding of tables. It's just used for a default value if table encoding is not specified

0

精彩评论

暂无评论...
验证码 换一张
取 消