国际性格问题
即使 php 页面的标头设置为 UTF-8 我收到此错误
这里是元标记
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
文本来自 php gettext。
我该如何解决这个问题?
谢谢
even though php page's header set to UTF-8 i get this error
here is meta tag
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
text is coming from php gettext.
how can i solve this ?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 gettext 的输出可能以 ISO-8859-1 进行编码。虽然您可以使用
utf8_encode()
手动转换它,但 gettext 有一个内置功能可以自动执行此操作。请参阅此处的用户评论:
http://www.php.net/manual/en /function.bind-textdomain-codeset.php#67200
在您的情况下,您需要:
显然,如果您的 gettext .mo 文件也以 UTF-8 编码,那将是最好的。
如果这还没有帮助,请尝试使用
setlocale("de_DE.UTF-8")
或putenv("LC_MESSAGES", "de_DE.UTF-8")< 覆盖区域设置/code> 和
LANG=
或类似的。The output is probably encoded in ISO-8859-1 when it came from gettext. While you could manually convert it with
utf8_encode()
, there is a builtin feature for gettext which should do that automatically.See the user comment here:
http://www.php.net/manual/en/function.bind-textdomain-codeset.php#67200
In your case you would need:
Obviously it would be best if your gettext .mo files were encoded in UTF-8 too.
If that doesn't help yet, try overriding the locale with
setlocale("de_DE.UTF-8")
or maybeputenv("LC_MESSAGES", "de_DE.UTF-8")
andLANG=
or similar.