CakePHP / Mysql 插入 UTF-8
一切都好吗?
那么,如下:
CakePHP 1.3.11
MySQL 5.1
Apache 2.2
PHP 5.3
字符集/整理为应用程序创建的数据库:
utf8
utf8_general_ci
app/config/database.php
'encoding' => 'utf8'
所有文件的字符集:
utf8
问题是什么? 当我尝试保存时,例如:
"Currículo"
我得到了回报,
"CurrÃculo"
问题出在哪里?
注意:在我的笔记本本地,应用程序工作正常,甚至保存不正确,也就是说,即使在银行获取数据时保存“Currículo”CakePHP,它们也会正确显示,但是当将其传递到客户端服务器时,出现在相同的位置数据库中的方式。
确实很奇怪。
all are well?
So, is the following:
CakePHP 1.3.11
MySQL 5.1
Apache 2.2
PHP 5.3
Charset / Collate the database created for the application:
utf8
utf8_general_ci
app / config / database.php
'encoding' => 'utf8'
charset of all files:
utf8
The problem?
When I try to save, for example:
"Currículo"
I got in return
"CurrÃculo"
Where is the problem?
Note: locally on my notebook, the application works correctly, even saving incorrectly, that is, even saving "Currículo" CakePHP when the bank takes the data, they are presented correctly, BUT when passing it to the client server, appeared in the same way in the database.
It really is very strange.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许eeee ..(我假设
Currículo
来自 HTML FORM )检查您在 head 标签上使用的字符集是否正确:
如果您使用的是 Firefox,请转至“查看”->“编码”以检查是否已选择 utf-8。 (元应该告诉 firefox 应该使用什么字符集)
如果这不是问题,请尝试做一个简单的查询测试,例如:
如果它不起作用,那么您就会知道问题出在 php 和 mysql 之间。
希望这有帮助。
maybeeeee.. ( i'll assume that
Currículo
comes from an HTML FORM )check that you're using the correct charset on the head tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
if you're using Firefox, go to View->Encoding to check that utf-8 is selected. (the meta should tell firefox what charset should be used)
If that's not the problem, try doing a simple query test, something like:
if it doesn't work, then you'll know that the problem is between php and mysql.
Hope this helps.