Character Encoding - Issue
Solved
lourdchien
Posted messages
7
Status
Member
-
lourdchien Posted messages 7 Status Member -
lourdchien Posted messages 7 Status Member -
Hello,
I have two PHP pages (XHTML 1.0 content) on the same local site, both using the same tag for character encoding:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Yet, accented letters are recognized in one page, while in the other, they are all replaced by a ? (question mark on a black background). I specify that the problem concerns the entirety of the page, not just imported content (from MySQL, for example).
What could be the problem?
Configuration: Linux / Firefox 3.6.3
I have two PHP pages (XHTML 1.0 content) on the same local site, both using the same tag for character encoding:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Yet, accented letters are recognized in one page, while in the other, they are all replaced by a ? (question mark on a black background). I specify that the problem concerns the entirety of the page, not just imported content (from MySQL, for example).
What could be the problem?
Configuration: Linux / Firefox 3.6.3
3 answers
-
Try this at the beginning of the page (just after your DB connection)
mysql_query("SET NAMES UTF8");
--
He’s got it free, he understands everything! -
The problem may stem from a poor configuration of the HTML editor, as the charset meta declaration is not enough.
For example, with NotePad++, you need to check in the format menu if the specified encoding is indeed utf-8 and not ansi.
--
<blockquote cite="Shakespeare">To be or not to be; that is the question...</blockquote> -
Indeed, and I believe I found that at the same time: Notepad++ is by default in ISO-####, and gedit is by default in UTF-8.