Charcter编码和PHP [英] Charcter encoding and PHP
问题描述
我正在建立一个使用PHP加载语言文件的多语言网站。语言文件中的段落在define()常量中设置。
在浏览器中打开页面后,我得到一堆字符,如?。在标记我有编码设置为utf-8。
I'm building a multilingual website that uses PHP to load language files. Paragraphs in the language file are set in define() constants. After opening page in the browser I get a bunch of characters like "?". In the markup I have encoding set to utf-8. What can be done to make it work other than replacing all unknown characters with html character entities?
推荐答案
- 可以做什么使其工作,而不是用html字符实体替换所有未知字符? >确保语言文件是utf8,
- 请确保您的HTML文件和模板是utf8,
-
标记您的专页
- Make sure you language files are utf8,
- make sure your HTML files and template are utf8,
make sure you add the following tag to your page
< meta http-equiv =Content-Typecontent =text / html; charset = UTF-8/>
< meta http-equiv="Content-Type" content="text/html; charset=UTF-8" / >
只要你的数据是utf8,模板和html文件是utf8,你明确指定html页面是utf8,它应该工作。
as long as your data is utf8, the template and html files are utf8 and you explicitely specify the html page is utf8, it should work.
编辑:代码嵌入的东西今天有点坏了...必须在标签opening.weird插入一个空格
the code embedding thing is a bit broken today... have to insert a space at the tag opening.weird
这篇关于Charcter编码和PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!