开发者

Strange chars on HTML output... in PHP

开发者 https://www.devze.com 2023-01-27 08:59 出处:网络
Character ó = ó and a开发者_开发问答ll TILDES... PHP is corrupting the output!! In the file I have ó

Character ó = ó and a开发者_开发问答ll TILDES... PHP is corrupting the output!!

In the file I have ó

Output :

ó

I have charset=UTF-8 ... but in the navigator the Character Encoding is setted to ISO-8859-1 I don't know why...

What to do?


It is probably not PHP. It would probably be that either the web server is enforcing an encoding (which is different from your file's), or you have not specified the correct output encoding.


It is possible that the content is sent correctly but the browser fails to detect the encoding scheme. You can check for this by trying to force the encoding in your browser. For instance in Firefox : View > Character Encoding > Unicode (UTF-8)

In this does solve the output problem, try to add this before any content is output.

header('Content-Type: text/html; charset=utf-8');

Alternatively, you can try those functions if you have the mbstring module installed. Set them to the encoding you are using.

  • mb_http_input
  • mb_http_output
  • mb_internal_encoding
  • mb_regex_encoding


It's most likely to do with the content type in your HTML Doc. Your HTML doc is serving up a content type different to the file your coding in. But you haven't provided much information.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号