Character Encoding - Issue

Solved
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

3 answers

  1. swoog42 Posted messages 1178 Status Member 245
     
    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!
    1
    1. lourdchien Posted messages 7 Status Member
       
      Unfortunately, it doesn't work; the problem is not related to the database. However, the two .php files were not created with the same software...
      0
  2. notobe Posted messages 2222 Status Member 213
     
    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>
    1
  3. lourdchien Posted messages 7 Status Member
     
    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.
    0