This topic has been archived. It cannot be replied.
-
工作学习 / 专业技术讨论 / 请问rollor高手,winXP,apache,PHP,mySQL,从网页向数据库加入中文记录,直接查看数据库显示正常,而从网页读出来就变成乱码,怎样支持多国文字呢?
-lionheart(lionheart);
2005-6-24
(#2364773@0)
-
不是rollor也不是高手,试一下在你的页面加入:
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
-holdon(again);
2005-6-24
(#2364883@0)
-
谢谢,已经有这句了,网页上静态的中文字符显示正常,但是从数据库查询得到的中文字符在网页上显示为乱码
-lionheart(lionheart);
2005-6-25
(#2365075@0)
-
不记的apache 关于多语言有什么设置啊。你试试装个phpmyadmin, 看看它显示数据库里的汉字正不正常?再有检查你的区域信息,default language改成中文?
-holdon(again);
2005-6-25
(#2365247@0)
-
我以前装mysql 3.23从来没问题。查了一下,“Mysql 4.1.x has introduced charsets. This was not in previous versions of mysql.“ 试试重编mysql configure以--with-charset=charsethttp://www.huihoo.com/mysql/manual/manual_Server.html#Character_sets
-holdon(again);
2005-6-25
{68}
(#2365257@0)
-
上面的每一个都可以设定charset,越改越乱啊
-lionheart(lionheart);
2005-6-25
(#2365993@0)
-
你的mysql 什么版本?我在两台不同的机器(linux,php), mysql 3.23 and mysql 4.0x上试了,全是default setting, 输入中文后都能直接用php显示。第3台机器linux+apache+php+mysql4.1.x, 用mysql insert 插入中文,select 可以正常显示,但是在网页上是乱码。我估计你需要重装mysql
-holdon(again);
2005-6-26
{125}
(#2366402@0)
-
和你第三台机情况基本一样winxp+apache+php+mysql4.1.x,,网页上动态数据是乱码,静态数据正常。
-lionheart(lionheart);
2005-6-26
(#2367238@0)
-
not familliar with your env. but my 2 cents is "output the character's ASCII value in every step(in php, in apache, in browser)"
-xordos(donothing);
2005-6-26
(#2366406@0)
-
我试了四个层charset的不同组合,越改越乱,还是microsoft的东西兼容性好。
-lionheart(lionheart);
2005-6-26
(#2367248@0)
-
I think M$ compatibility with other software is the worst. My suggestion is printout the ASCII value in each layer, and find out which layer is the problem, and fix that layer.
-xordos(donothing);
2005-6-26
(#2367287@0)
-
After connecting DB, selecting Schema, run this "SET NAMES 'gb2312'", then do select. Make sure you do this when INSERT also. garbage in, garbage out.
-elecskunk(elecskunk);
2005-6-27
(#2368314@0)
-
这招已经用过了,还是一样的结果
-lionheart(lionheart);
2005-6-27
(#2368332@0)