在php.ini中设置信息如下:
HTTP Headers Information
HTTP Request Headers
HTTP Request GET / HTTP/1.1
Accept image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, */*
Accept-Language zh-cn
UA-CPU x86
Accept-Encoding gzip, deflate
User-Agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; CIBA)
Host 172.16.0.128
Connection Keep-Alive
HTTP Response Headers
X-Powered-By PHP/5.2.6
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Transfer-Encoding chunked
Content-Type text/html; charset=utf-8
iconv
iconv support enabled
iconv implementation "libiconv"
iconv library version 1.11 Directive Local Value Master Value
iconv.input_encoding utf8 utf8
iconv.internal_encoding utf8 utf8
iconv.output_encoding utf8 utf8
HTTP Headers Information
HTTP Request Headers
HTTP Request GET / HTTP/1.1
Accept image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, */*
Accept-Language zh-cn
UA-CPU x86
Accept-Encoding gzip, deflate
User-Agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; CIBA)
Host 172.16.0.128
Connection Keep-Alive
HTTP Response Headers
X-Powered-By PHP/5.2.6
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Transfer-Encoding chunked
Content-Type text/html; charset=utf-8
iconv
iconv support enabled
iconv implementation "libiconv"
iconv library version 1.11 Directive Local Value Master Value
iconv.input_encoding utf8 utf8
iconv.internal_encoding utf8 utf8
iconv.output_encoding utf8 utf8
页面显示正确是因为你的数据来自于页面,所以可能不会出现问题.mysql和mysqladmin出现乱码,很有可能与其连接方式有关系的.
比如phpmyadmin在首页上就有设置.
还要确定PHP文件是否是UTF-8的编码,最好连Apache也设置上UTF-8
但是在页面输出时却出现乱码。还有在mysql终端上也是乱码。求解????
但是在页面输出时却出现乱码。还有在mysql终端上也是乱码。求解????
简单的页面如:
<?php require_once('Connections/query.php'); ?>
<?php
mysql_query("set names GB2312;");
mysql_select_db($database_query, $query);
$query_getquery = "SELECT * FROM patient_base";
$getquery = mysql_query($query_getquery, $query) or die(mysql_error());
$row_getquery = mysql_fetch_assoc($getquery);
$totalRows_getquery = mysql_num_rows($getquery);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<?php echo $row_getquery['patient_id']; ?><?php echo $row_getquery['name']; ?><?php echo $row_getquery['sex']; ?><?php echo $row_getquery['age']; ?><?php echo $row_getquery['work']; ?>
</body>
</html>
<?php
mysql_free_result($getquery);
?>
我用mysql_query("set names GB2312;");和mysql_query("set names utf8;");都试过,出现
页面输入数据后能在phpadmin正确显出。
但是在页面输出(输出页面如上)时却出现乱码。还有在mysql终端(dos下)上也是乱码
是什么意思啊!我是新手,能说具体一点吗?
还问一个问题mysql终端(dos下)上中文也是乱码,怎么解决?