MySQL±àÂëµÄÎÊÌâ
ÎÒµÄMySQL±àÂ룬ÎÒÔÚmy.iniÖÐÉèÖõÄΪutf8,ÔÚ´´½¨Êý¾Ý¿âʱѡÔñµÄ±àÂëΪutf8_Unicode_ci£¬ÎÒÔÚ¡¢´ÓÒ³Ãæ²åÈëÊý¾Ý¿â£¬ÔÚÒ³ÃæÉÏÏÔʾÕý³££¬µ«´ÓphpmyadminÖУ¬²é¿´Ê±£¬ÏÔʾΪÂÒÂ루ÎÒÎÒ¡£¡£¡££©ÀàËÆÓÚÕâÑùµÄÂÒÂ룬´ÓphpmyadminÖУ¬²åÈëÊý¾Ýʱ£¬´ÓÒ³ÃæÉϲ鿴£¬ÏÔʾΪÂÒÂ루£¿£¿£¿£¿£©ÀàËÆÓÚÕâÑùµÄÂÒÂ룬ÎÒµÄÍøÒ³ÖУ¬Ö±½ÓÌí¼ÓµÄform±íµ¥£¬Ã»¼ÓÈë <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />±àÂë˵Ã÷£¬ÔÚÒÔǰûÎÊÌâµÄ£¬½ñÌìÉÏÀ´¾Í³öÎÊÌâÁË¡£¡£¡£
¸÷λ´óÏÀ£¬¸æËßÏÂÔÒò¡£¡£¡£
ÉèÖÃÒ»ÏÂphpmyadminµÄ±àÂëÓ¦¸Ã¾Í¿ÉÒÔÁË,Ê×Ò³×óÉϽÇÓиöLanguageµÄµ¥Ñ¡¿ò,Ñ¡Ôñ
ÖÐÎÄ-Chinese simplified
ÎÒÉèÖõľÍÊÇÖÐÎÄ-Chinese simplified
ÔÚÍøÒ³Ö´ÐвåÈëÊý¾Ý֮ǰ²åÈëÕâ¾ä´úÂ룺
mysql_query("set names utf8");
ÐÂÊÖ£¬¿´¿´£¡
ÎÒÉèÖÃmysql_query("set names utf8");
ÔõôÌáʾ´íÎó
ÎҵĴúÂëPHP code:
<?php
function db_connect()
{
$db = @ new mysqli("127.0.0.1","root","","wangliuwei");
mysqli_query("set names 'gbk'");
if (mysqli_connect_errno())
{
echo "Êý¾Ý¿âÁ¬½Óʧ°Ü";
echo mysqli_connect_error();
exit;
}
return $db;
}
?>
¸÷λ´óÏÀÃÇ£¬¸æËßÏ°ɡ£¡£¡£
ÔõôûÈ˻ش𣿣¿£¿£¿
×Ô¼º¶¥ÏÂ
ÄãÊý¾Ý¿â my.in
Ïà¹ØÎÊ´ð£º
ÓÃjsp×ö¶«Î÷¸øÍêÈ«²»¶®mysqlµÄÈËÓ㬿ÉÊDZ¸·ÝʱֻÓпÕÎļþ£¬ÕâÊÇʲôÇé¿ö£¬
×îºÃÓÐÔ´´úÂ룬лл
Æäʵ±¸·ÝµÄ¹ý³ÌÎÒÏë´ó¸ÅÊÇÕâÑùµÄ£º
½«±íAÖеÄÊý¾Ý·Åµ½ArrayListÖУ¬È»ºó½«Õâ¸öArrayListÖеÄÊý¾ÝÔÙ´æµ½±íBÖС£ ......
jspÌá½»Ò³±àÂëÊÇUTF-8£¬MYSQL¿âÒ²ÊÇUTF-8,ΪʲôÌá½»ÁËÖÐÎÄ×Ö·ûÔÚÊý¾Ý¿âÀï±ä³ÉÂÒÂëÁËÄØ£¿
ÕâÖÖÎÊÌâÔõô½â¾ö£¿Ð»Ð»
ÁíÍ⣬JSPµ¯³ö¶Ô»°¿ò£¨±ÈÈ絯³ö¡°XXXÉóºËͨ¹ý¡±ÏÂÃæ¸úÈ·¶¨°´Å¥£©ºÍ·µ»ØÉÏÒ»Ò³ÒÔ¼°×ªµ ......
ÔÚphpÖÐÓÃÕâ¾ä¾Í¿ÉʵÏÖ¶Ô¿Í»§¶Ë×Ö·û¼¯µÄÉèÖÃ....
mysql_query("set names gb2312")
ÇëÎÊÔÚjspÖÐÈçºÎʵÏÖÕâ¾ä¹¦ÄÜ£¿£¿£¿
jspÖУº
<%@page language="java" contentType=&q ......
ÎÒÔÚ³ÌÐòÀïÃæдÁËÒ»¸ö¼àÌýÆ÷£¬TomcatÆô¶¯µÄʱºò¾Í»áÈ¥¼ì²âÊý¾Ý¿âÊÇ·ñÁ¬½ÓÉÏÁË£¬µ«ÊDZ¨ÁË´í
Access denied for user 'root'@'localhost' (using password: YES)
·ÃÎʱ»¾Ü¾ø£¬ÔõÑùÐ޸ķÃÎÊÓû§µ ......