0

I have a list with German text that includes special characters like Ä, Ö, etc.

I develop my website using chrome, which takes care of these characters automatically, but some of them can't be displayed in the FireFox browser.

After trying to use mb_convert_encoding( STRING, 'utf-16', 'utf-8' ) to encode my string, it works well in FireFox, but not in Chrome anymore (The characters are displayed like this: �). I already used charset="UTF-8" in my <meta>tag.

Is there a way to fix this for both browsers?

Thanks

barbarossa
  • 129
  • 1
  • 11
Sandy
  • 210
  • 3
  • 16
  • what happens if you try to convert using [`iconv()`](http://php.net/manual/en/function.iconv.php)? – Filnor Nov 09 '17 at 08:13
  • @chade_ i tried using iconv("UTF-8", "ISO-8859-1", STRING) and its just like when i use mb_convert_encoding( STRING, 'utf-16', 'utf-8' ) – Sandy Nov 09 '17 at 08:19
  • What encoding is the text actually in, what encoding is declared in the meta tags (UTF-8, yes?), what encoding is declared in the HTTP headers? – deceze Nov 09 '17 at 08:38
  • @deceze yes, encoding that i use for meta tags is UTF-8, and for HTTP headers, it is ISO-8859-1 – Sandy Nov 09 '17 at 08:47
  • Well, there's your problem. Fix your headers. – deceze Nov 09 '17 at 08:55
  • @deceze i tried it and its works, Thanks !! :) – Sandy Nov 09 '17 at 09:17
  • @deceze just want to confirm, before i change my response header to UTF-8, it's works well in Chrome, is this mean Chrome has some feature to handle this? – Sandy Nov 09 '17 at 09:19
  • Maybe it's trying to iron out your mistakes, like when there's a discrepancy between HTTP headers and meta tags it tries to figure out which seems more likely. I don't know, it's up to each browser to handle that as best it can. It's *your* job to set the correct headers. – deceze Nov 09 '17 at 09:28
  • @deceze okay, thank you for your explanation. please submit your answer so i can close this :) – Sandy Nov 09 '17 at 09:38

0 Answers0