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?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
header('Content-Type:text/html; charset=UTF-8');
use this line on the top of your PHP code to send header; also helps with validation of dynamic pages to get rid of utf warning.
make sure you add the following tag to your page
< meta http-equiv="Content-Type" content="text/html; charset=UTF-8" / >
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.
EDIT: the code embedding thing is a bit broken today... have to insert a space at the tag opening.weird