查看: 1389|回复: 13
|
如何输入华文字 - MySql
[复制链接]
|
|
我用php+mysql
请问如何输入华文字在mysql database ?? |
|
|
|
|
|
|
|
发表于 9-6-2006 11:21 PM
|
显示全部楼层
在你的 php 里放这个:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> |
|
|
|
|
|
|
|
发表于 10-6-2006 05:39 AM
|
显示全部楼层
原帖由 goatstudio 于 9-6-2006 11:21 PM 发表
在你的 php 里放这个:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
goatstudio兄,
小弟是选用Unicode的encoding方式来储存中文字的,也就是charset=UTF-8。
好处是当查看记录的时候,若游览器encoding的默认设置为unicode的话,
就能同时翻译简体和繁体。
若这时通过Dos-prompt登入mysql查看相关记录的话,就会发现记录的字全是乱码。
若通过php的网页(encoding设置为unicode)查看的话,就完全正常。
我想你所推荐的方法只能储存简体字,并不能储存繁体字,与不能
同时翻译简体与繁体字吧?
前提是,我早在这之前去php.ini内更改mbstring的设置,因此不确定是否受到其影响。
http://aspn.activestate.com/ASPN/docs/PHP/ref.mbstring.html
[ 本帖最后由 亡者之疯 于 10-6-2006 06:21 AM 编辑 ] |
|
|
|
|
|
|
|
发表于 11-6-2006 03:21 AM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 17-6-2006 05:46 PM
|
显示全部楼层
原帖由 goatstudio 于 9-6-2006 11:21 PM 发表
在你的 php 里放这个:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
谢。。
可是,我在browser开。。
http://localhost/test.html 也是看不到华文字。
但如果是开 file:///c:/web/test.html 就看到。
怎么办? |
|
|
|
|
|
|
|
发表于 19-6-2006 09:43 AM
|
显示全部楼层
把你的 code 放上来看看... 很可能你储存的已经是乱码. |
|
|
|
|
|
|
|

楼主 |
发表于 19-6-2006 12:08 PM
|
显示全部楼层
原帖由 goatstudio 于 19-6-2006 09:43 AM 发表
把你的 code 放上来看看... 很可能你储存的已经是乱码.
ok.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<p align="center">放</p>
</body>
</html>
好像这个,我直接开就看到“放“。
如果在localhost开,就看不到。
 |
|
|
|
|
|
|
|
发表于 19-6-2006 02:00 PM
|
显示全部楼层
看不到? 你 viewsource 看到的是什么? 你用什么来 save? |
|
|
|
|
|
|
|

楼主 |
发表于 19-6-2006 04:16 PM
|
显示全部楼层
save as .html
viewsource 看到的是
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<p align="center">放</p>
</body>
</html>
直接开document就看到“放“
如果在localhost开,就看不到。 |
|
|
|
|
|
|
|
发表于 20-6-2006 09:24 AM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 20-6-2006 11:32 AM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 20-6-2006 11:39 AM
|
显示全部楼层
会不会是需要改php.ini 或是 httpd.conf里的一些东西? |
|
|
|
|
|
|
|
发表于 20-6-2006 02:24 PM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 20-6-2006 06:40 PM
|
显示全部楼层
谢谢.
可以了。
"为了指定 Apache 识别中文,我们指定 GB2312 为默认编码。应该找到并定位到下面这行
AddDefaultCharset ISO-8859-1
将其修改为:
AddDefaultCharset GB2312" |
|
|
|
|
|
|
| |
本周最热论坛帖子
|