random1 Posted February 16, 2010 Share Posted February 16, 2010 Hi All, I've set up my site with UTF-8 but occasionally when I view the site I have incorrect characters appearing like: In the above example the left is arabic characters and the right is korean. The browser I'm using is Firefox. Any ideas? Link to comment https://forums.phpfreaks.com/topic/192210-utf-8-and-incorrect-display/ Share on other sites More sharing options...
sangoku Posted February 16, 2010 Share Posted February 16, 2010 quite few, but to lithe explanation jokes aside. i had teh same problem to for some time. you probably made one of the files which contain your php code in a difrent code than the encoding you are giving in the header of your html.... you will have quite a mess to corect it. go to all files and save them in the utf or what ever encoding you are using. Link to comment https://forums.phpfreaks.com/topic/192210-utf-8-and-incorrect-display/#findComment-1012931 Share on other sites More sharing options...
random1 Posted February 16, 2010 Author Share Posted February 16, 2010 Found it! In my code all page output is from a buffer that is UTF-8. I changed part of my code from: // Encode HTML to UTF-8 if($htmlencode == true) { // HTML is not UTF-8 Encoded if(mb_detect_encoding($buffer) != 'UTF-8' || mb_detect_encoding($buffer) != 'UTF8') { // Enforce UTF-8 Encoding $buffer = utf8_encode($buffer); } } to: // Encode HTML to UTF-8 if($htmlencode == true) { // HTML is not UTF-8 Encoded if(mb_detect_encoding($buffer) != 'UTF-8') { // Enforce UTF-8 Encoding $buffer = utf8_encode($buffer); } } Thanks for replying Link to comment https://forums.phpfreaks.com/topic/192210-utf-8-and-incorrect-display/#findComment-1012943 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.