1

My webpage's response headers show this:

Content-Type:text/html; charset=UTF-8

However, I still get a black diamond with white question mark for characters like é. What am I supposed to do exactly? It's my .htaccess that's setting UTF-8.

StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
  • 1
    `Content-Type` only lets browser understand how to decode the content; it's your responsibility to encode it correctly. – raina77ow Nov 03 '12 at 13:42
  • I'm using Zend Studio. Are you saying that might be the culprit? – StackOverflowNewbie Nov 03 '12 at 13:42
  • http://www.w3.org/International/questions/qa-changing-encoding – durron597 Nov 03 '12 at 13:43
  • 1
    Your data is encoded in ISO-8859-1 or Windows-1252, but you serve it as UTF-8. Note that the header is only a hint to the browser, it does't make your data magically utf-8. If the hint is wrong, you get garbage like the black diamond unicode replacement character in this case. – Esailija Nov 03 '12 at 13:44
  • 1
    Read [The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)](http://www.joelonsoftware.com/articles/Unicode.html). –  Nov 03 '12 at 13:54

2 Answers2

1

If its a script or HTML file, check the encoding of the file itself, which should be saved as UTF-8.

In Zend, its something like: Edit->Set encoding->Other: UTF-8,

nickhar
  • 19,981
  • 12
  • 60
  • 73
  • Is this a global solution? Do do I need to go through my hundreds of files and re-saved them? – StackOverflowNewbie Nov 03 '12 at 13:46
  • Ah, you could try this then: http://stackoverflow.com/questions/755245/zend-studio-for-eclipse-switch-character-encoding-for-all-files-in-a-project – nickhar Nov 03 '12 at 13:48
0

If you are serving a HTML page you need to indicate in the HTML file that the content is UTF-8. You can do this by adding a meta html tag to your header section:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">