Rumah >pangkalan data >tutorial mysql >PHP乱码来源分析
PHP项目出现乱码,原因就是软件之间,模板之间的编码有差异,不相同:
mysql_query("set character set 'utf8'"); //读库
mysql_query("set names 'utf8'"); //写库
//html页面中使用的编码
补充:
# Lang-abbvCharset Language
#---------------------------------
en ISO-8859-1 English
UTF-8 utf8 UTF-8
Unicode ucs Unicode
th Cp874 Thai
ja SJIS Japanese
ko Cp949 Korean
zh Cp950 Chinese-Traditional
zh-cn GB2312 Chinese-Simplified
zh-tw Cp950 Chinese
cs ISO-8859-2 Czech
hu ISO-8859-2 Hungarian
hr ISO-8859-2 Croation
pl ISO-8859-2 Polish
ro ISO-8859-2 Romanian
sr ISO-8859-2 Serbian
sk ISO-8859-2 Slovak
sl ISO-8859-2 Slovenian
sq ISO-8859-2 Albanian
bg ISO-8859-5 Bulgarian
be ISO-8859-5 Byelorussian
mk ISO-8859-5 Macedonian
ru ISO-8859-5 Russian
uk ISO-8859-5 Ukrainian
ca ISO-8859-1 Catalan
de ISO-8859-1 German
da ISO-8859-1 Danish
fi ISO-8859-1 Finnish
fr ISO-8859-1 French
es ISO-8859-1 Spanish
is ISO-8859-1 Icelandic
it ISO-8859-1 Italian
nl ISO-8859-1 Dutch
no ISO-8859-1 Norwegian
pt ISO-8859-1 Portuguese
sv ISO-8859-1 Swedish
af ISO-8859-1 Afrikaans
eu ISO-8859-1 Basque
fo ISO-8859-1 Faroese
gl ISO-8859-1 Galician
ga ISO-8859-1 Irish
gd ISO-8859-1 Scottish
mt ISO-8859-3 Maltese
eo ISO-8859-3 Esperanto
el ISO-8859-7 Greek
tr ISO-8859-9 Turkish
he ISO-8859-8 Hebrew
iw ISO-8859-8 Hebrew
ar ISO-8859-6 Arabic
et ISO-8859-1 Estonian
lv ISO-8859-2 Latvian
lt ISO-8859-2 Lithuanian