Chinese Characters Not Rendering
Hello,
I have a page containing simplified chinese characters. The characters render perfectly in Chrome, Safari, IE and Android. However, the chinese characters will not render in Firefox (v 17.0.1). I've tested this both on a mac and windows. Also had other users with on both macs and pcs with the same results. The page is UTF 8 encoded.
Thank you.
All Replies (9)
Can you give the website you are seeing this on?
here's the code i'm using to test. very simple. i also selected "UTF 8 with BOM when saving in BBEdit.
====
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>For Parents: Home Page</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <body> Simplified Chinese </br> 世界各地的青年女性因其在全美所享有的至高声望和所提供的卓越大学。</br> </br> Traditional Chinese</br> 世界各地的青年女性因其在全美所享有的至高聲望和所提供的卓越大學課程。</br> </body> </html>
Gewysig op
Note that you seem to be missing a closing </head> tag before the <body>
A BOM doesn't matter if the server sends the file with a specific encoding.
Firefox will always use the encoding as send by the server in that case.
You can check the content type in Tools > Page Info > General and you can also use the Web Console (Web Developer > Web Console;Ctrl+Shift+K) to check the response headers.
Do you have an online link that we can check?
Gewysig op
Thanks for your reply. This is a page (php) that is not rendering on our server at work (Apache). When I tested it on my personal web host server (also Apache), it rendered fine in Firefox! Could there possibly be a setting in the httpd.conf file that causes Firefox to behave differently than other browsers when it comes to Chinese characters?
If the page is a php page then try to add this header at the start of the file:
<?php header('Content-Type: text/html; charset=utf-8'); ?>
Yes, you are right. It looks like our work server is sending ISO-8859-1 encoding. My personal web host server is sending UTF-8.
Thanks for the php header function suggestion. That seems to have fixed the problem! I am curious though, why all other browsers handled the utf8 page without needing that header??
You're welcome.
If the server sends an (in this case wrong) encoding then Firefox will always use the encoding as send by the server.
Only if the server doesn't send an encoding then will Firefox check (sniff) the content of the file to see if it needs to use an encoding that is different from the default encoding as set in Options. This may trigger a reread in case it happens further down in the file and content has already been rendered and thus will delay things. For security reason it is always best to have the server decide how to send files and make sure that all files have that same encoding (best is to use UTF-8).
Thanks again. This was excellent support. My problem is fixed and I learned a lot along the way. Much appreciated!