Which is the best character encoding for Japanese language for DB, php, and html display?(哪种是用于 DB、php 和 html 显示的日语的最佳字符编码?)
问题描述
我只想了解日语的语言翻译,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 显示的日语的最佳字符编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:哪种是用于 DB、php 和 html 显示的日语的最佳字符编码?


基础教程推荐
- 在多维数组中查找最大值 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01