PHP,sql,UTF-8编码 [英] PHP,sql, UTF-8 encoding
问题描述
对于开始,我使用:
<?xml version =1.0encoding =utf-8?>
和:
code>< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
所以xml编码是 utf-8 ,同样的是 meta charset ,我正在使用的文件是 UTF-8 ,而在Notepad ++里面是没有BOM的UTF-8 ,在sql server数据库和表格是 utf8_general_ci ,
问题是当我从php代码插入数据我在浏览器中看到数据可以,但是在sql server上出现奇怪的情况,当我插入来自sql server的数据时,我看到数据,
确定在sql服务器,但奇怪的浏览器,如果有人知道的东西,我将非常感谢。
什么样的你使用sql server吗?
我的postgres或mysql的情况,你应该定义
表和字段为utf-8知道。
否则,当db通过csv填充,
里面的数据不是utf-8编码的,你的页面
上的结果也不会被utf-8编码。
在这种情况下,您可以手动转换字符集。
I am trying to understand some problem at the UTF-8 encoding at the forum i am building, For start, I am using:
<?xml version="1.0" encoding="utf-8"?>
and:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
So the xml encoding is utf-8 and same is for the meta charset, also the files i am working with is UTF-8 and inside the Notepad++ it is UTF-8 without BOM, at the sql server the database and the tables are utf8_general_ci,
The problem is when i am inserting the data from the php code i see the data ok at the browser but weird at the sql server,
when i inserting the data from the sql server i see the data ok at the sql server but weird at the browser, If anyone know something please i will be very thankful.
What kind of sql server do you use? I case of postgres or mysql, you should define the tables and or the fields as utf-8 aware.
Otherwise, when the db was filled via csv and the data inside are not utf-8 encoded, the result on your pages will be then also not utf-8 encoded.
In that case, you can transform the characterset manually.
这篇关于PHP,sql,UTF-8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!