使用CakePHP输出UTF-8 [英] UTF-8 output with CakePHP
本文介绍了使用CakePHP输出UTF-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将一些Excel-Data移动到MySQL,但是编码困难。
- 将 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
问候,
Benedikt
解决方案
我有类似的症状,我的解决方案是添加
'encoding'=> 'UTF8'
to 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屋!
查看全文