如何在php页面上显示日语字符? [英] How to display Japanese characters on a php page?

查看:530
本文介绍了如何在php页面上显示日语字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在PHP页面上显示日语字符。没有从数据库加载,只是存储在语言文件中并回显。

I'm trying to display Japanese characters on a PHP page. No loading from the database, just stored in a language file and echo'ed out.

我遇到了一个奇怪的情况。我有页面正确设置与UTF-8和我测试在我的本地WAMP服务器上的示例页面,它的工作原理。

I'm running into a weird scenario. I have the page properly setup with UTF-8 and I test a sample page on my local WAMP server and it works.

我测试了我们的开发和生产服务器的字符不能正确显示的那一刻。

The moment I tested it out our development and production servers the characters don't display properly.

这让我相信这是php.ini中的一个设置。但我没有找到很多有关这方面的信息,所以我不确定这是否是这个问题。

This leads me to believe then that it's a setting in php.ini. But I haven't found much information about this so I'm not really sure if this is the issue.

有缺少基本的东西吗?

感谢

推荐答案

因为你声明它是在你的开发环境而不是在你的live,你可能想检查Apache的 AddDefaultCharset 并将其设置为UTF-8(如果尚未设置)。

Since you've stated that it is working in your development environment and not in your live, you might want to check Apache's AddDefaultCharset and set this to UTF-8, if it's not already.

我倾向于检查以下步骤


  1. PHP标头以UTF-8发送

  2. 元标记设置为UTF-8(Content-Type)

  3. 存储设置为UTF-8

  4. 服务器输出设置为UTF-8

  1. PHP Header is sent in UTF-8
  2. Meta tag is set to UTF-8 (Content-Type)
  3. Storage is set to UTF-8
  4. Server output is set to UTF-8

这似乎对我有用。希望这有助于。

That seems to work for me. Hope this helps.

这篇关于如何在php页面上显示日语字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆