带有CakePHP的UTF-8输出 [英] UTF-8 output with CakePHP
本文介绍了带有CakePHP的UTF-8输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我做了什么:
$ 我试图将一些Excel数据移动到MySQL, b $ b
- 从 OpenOffice 3.1 导出的数据为 csv ( utf-8 编码)
- 通过文件上传导入phpMyAdmin(表编码:'* utf8_unicode_ci *')
在phpMyAdmin的查看模式下,数据正确显示(它使用utf-8作为字符集):
; meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
当我尝试在我的网页上显示数据时,我得到一个带有问号的哈希。
系统信息
- 我尝试访问我的页面:
德语 - MySQL客户端版本:5.0.32
- 我的操作系统:MAC OS X 10.5。 7
- 服务器脚本:CakePHP v1.2.3.8166
b Benedikt
解决方案
我有一个类似的症状,我的解决方案是添加
'encoding'=> 'UTF8'
到config / database.php
I'm trying to move some Excel-Data to MySQL, but having troubles with encoding.
What I did:
- Data export from OpenOffice 3.1 as csv (utf-8 encoded)
- Import to phpMyAdmin via file upload (Table encoding: '*utf8_unicode_ci*')
In phpMyAdmin's view mode, the data is displayed correctly (it is using utf-8 as charset):
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
When I try to display the Data on my webpage, I get a hash with a question mark in it.
System-Info
- The language I try to get on my page: German
- MySQL client version: 5.0.32
- My OS: MAC OS X 10.5.7
- Server-Script: CakePHP v1.2.3.8166
Regards, Benedikt
解决方案
I had a similar symptom, my solution was to add
'encoding' => 'UTF8'
to config/database.php
这篇关于带有CakePHP的UTF-8输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文