开发者

Zend project - mysql not fetching UTF8

开发者 https://www.devze.com 2023-03-06 16:20 出处:网络
I h开发者_运维百科ave one Zend project where I use mysql - my db connection collation is utf8_unicode_ci and my tables collation is utf8_unicode_ci. I have stored successfully some records which conta

I h开发者_运维百科ave one Zend project where I use mysql - my db connection collation is utf8_unicode_ci and my tables collation is utf8_unicode_ci. I have stored successfully some records which contain UTF8 characters but when I try to fetch them from the DB they're broken e.g.:

DVI•1500HD is fetched as DVI•1500HD

I've tried setting resources.db.params.charset = utf8 in application.ini but it doesn't fix the problem.

Any ideas?


Try adding the following line to your config.

resource.db.params.driver_options.1002 = "SET NAMES utf8"

Regarding to your Zend Framework version, this command is needed to change the transfer encoding of mysql. The given command is the first thing executet when intantiating the db adapter.


Maybe the content you get from the database is UTF8, but it goes wrong in your presentation. Do you send the correct content-type header when presenting in a webpage? And is that page also saved as UTF8 document?


I have try all the solutions from above , at the end fix with this in the freetds.conf

(/etc/freetds/freetds.conf)

[myserver]

tds version = 8.0

client charset = UTF-8

0

精彩评论

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

关注公众号