哪个是日语最好的字符编码的DB,php和html显示? [英] Which is the best character encoding for Japanese language for DB, php, and html display?
问题描述
我只是想知道日语的语言转换,
1)哪个是数据库的最好的编码mysql
2)哪个/我如何打印在HTML页面。 ?
提前感谢。
i just want to know about the language transation for the Japanese, 1) Which is the best encoding for the database mysql 2) Which/how can i print that in HTML page. ? thanks in advance.
推荐答案
UTF-8毫无疑问。使一切UTF-8。要在您的网页上放置UTF-8编码文本,请在您的HEAD标记中使用:
UTF-8 without a doubt. Make everything UTF-8. To put UTF-8 encoded text on your web page, use this within your HEAD tag:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
对于MySQL,将以下内容放入my.cnf(config)文件:
As for MySQL, put the following into your my.cnf (config) file:
[mysqld]
collation_server=utf8_unicode_ci
character_set_server=utf8
default-character-set=utf8
default-collation=utf8_general_ci
collation-server=utf8_general_ci
您可能需要在取得日文文字之前执行这两个查询:
If you're getting garbage characters from the database from queries executed by your application, you might need to execute these two queries before fetching your Japanese text:
SET NAMES utf8
SET CHARACTER SET utf8
这篇关于哪个是日语最好的字符编码的DB,php和html显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!