Link to home
Start Free TrialLog in
Avatar of Dionysus
Dionysus

asked on

Having trouble with chinese characters - viewing local html file OK but same file viewed online from server displays wrong

I don't know why the same file displays differently when viewed in any browser locally on my machine and when uploaded and viewed in the same browsers online.

I'm trying to view 2 different files.. one in traditional chinese and the other in simplified chinese (charsets big5 and gb2312).

At first I thought it was a browser thing but then I saw the same thing in other browsers.

Any ideas please?

Thanks,
D
Avatar of Irwin Santos
Irwin Santos
Flag of United States of America image

The server is not using the same character set as the local machine.
Avatar of Dionysus
Dionysus

ASKER

Thanks for your response... that seems likely.. however..  what do I do?

The problem is that I have the 2 versions of Chinese and regular english - how can I set the server to properly dislay these?

D
By the way, I tried using PHP to set the server for the page but the page doesn't even load after I add the following code:

header('Content-type: text/html; charset=big5');

?

D
OK..the PHP was not the problem.. it was the XML coding I tried.. the PHP header function does nothing at all... same problem.. :(
this also begs the question, why does declaring my xml encoding make the page display blank?
Avatar of Zyloch
You may want to try to force the server to send out the correct content-type headers for your particular file(s). If you have Apache, and .htaccess, you can include this:

<Files "chinese.html">
AddCharset big5 .html
</Files>

More information may be found at http://www.w3.org/International/questions/qa-htaccess-charset

As for why your XML encoding is forcing the page to display blank, that depends on what exactly you're doing. Can you clarify a little more? And does this affect more than one browser?
I am hosting with someone else and do not have access to the server in that way.. but yes, the server is Unix/Apache..

However I already spoke with them and suggested AddCharset - as well as AddType.  They told me that the server is already set up to encode various languages including Chinese.

I'm now waiting to hear back from them..

The xml issue was causing a problem for my browser..  so I tried and had the same problem in Mozilla, Safari (on Mac) and Mozilla, Explorer (on PC) and each time.. nothing at all on the page.. just blank.

I've since removed it.. according to the W3C - it's low on the list of deciding factors..
Alright. Let us know if anything new pops up with the charset question. I don't see you doing anything wrong; the PHP header() you sent looks fine. You could also use a <meta> tag directly in the <head> section, but it should amount to the same effect anyways. If it's anything, it probably is the server, though if worst comes to worst, most browsers allow the user to manually change encodings, and you can let your visitors know how to do that in the most popular browsers.

If you feel you need to address the XML problem, feel free to post more details (code, perhaps). Otherwise, you're set.
The meta tag is there too..  from the beginning.. hasn't done anything. :(

The thing is.. when I look in my browser to see what encoding (set to Auto)...it shows correctly as "Chinese Traditional - big5" - however it doesn't display correctly.

I can only assume it's the server because nothing else makes sense.

Thanks for responding so quickly.. sometimes on here, it's painful to wait days with no response to a question.. and of couse, every question needs to be solved ASAP.. :)

Anyway.. thanks for your help.. I'll keep you posted.. hopefully sooner rather than later.

D
One more thing..  this site is a 3 language site.. Chinese Traditional (big5), Chinese Simplified (gb2312) and English.

That's why I thought that PHP's header function would be the way to do it, in tandem with the meta tag, so that different pages could have different encoding.

Funny thing is that when I leave it at  >> header('Content-type: text/html; charset=big5'); <<  it doesn't work.. however.. when I change it to utf-8, it completely makes everything much worse off.  So I have proof that the PHP header does SOMETHING.. it's just that the big5 doesn't work as it's supposed to.

Very strange.

For the record.. I'm using XHTML, transitional in the DOCTYPE..

D
Interesting. If you manually change your browser to display in big5, does it work?
It is already in big5 - it auto detects it..  but I change it to something else and then back.. and it's the same.. not quite right..  full of question marks and some chinese characters (but not necessarily the right ones).

However.. as I said.. the same file on my desktop will auto-detect and CORRECTLY display.

D
I feel useless since I don't have much else to add. It's strange that this bug appears in multiple browsers, all which seem to read and interpret your local file perfectly. If I were to guess, I would say it definitely is a server problem, although I am not sure what you can do if your host says everything is alright. You might want to try on a different (maybe free) host just to confirm whether it is a server problem or not.
That's a good point.. I'll try that on my own hosting package.. see what happens..

I'll be back..

D :)
Well.. bad news..

Even on my own personal hosting package..  the same thing is happening.. With and without the php header call, with and without the DOCTYPE..

However.. all that might mean is that a lot of North American hosting companies don't have many requests for serving chinese web sites.

Not sure what else to do..  it might help if I had deeper control over the server.. but I doubt that I'd be allowed.. so the only option I can think of right now is to save the text as a graphic file.. however.. that is the lamest solution available and will harm the website in terms of searchabiity.

D
You can view the file itself on my server..

http://www.aethon.net/welcomeb.php

Try and save the file after and view it locally in your browser and see if it looks correct.

I've attached a screenshot of the correct layout at www.aethon.net/big5.png

D
Definitely don't save the text as a graphics file. It might be possible that many of these hosts are not set up to correctly display Chinese, since it is not extremely prevalent. Of course, you could set up your own server, download Apache, and then you would have ultimate control, but aside from that and searching for better hosting companies, I don't know what else to say. Sorry.
Hey.. could it be because I'm using fonts in the CSS? Or would encoding overrride that?

D
Yes, I can confirm that though the encoding is correct, the text is still half gibberish in both FF2.0 and IE6. In fact, I can't even save the file correctly, since it will only save the gibberish.
Yes, fonts are a big possibility! The encoding would not overwrite anything. Try reverting to just Arial and see how it goes.
Nope.. makes no difference.
:( Thought I had found something there!

Your enthusiasm and participation is helping though :)
Me too. I think I read somewhere that only certain fonts were supported. Aha! I found it again on a Google search: http://www.hotpeachpages.net/a/characters.html
You're right.. it saves the gibberish..   try the file as a zip

www.aethon.net/welcomeb.htm.zip

I just removed the php header call..  see if it looks like the PNG

D
Yes, it looks completely fine in both IE and FF. I even tried changing the font, and it was unfazed.
Well that is so damn bizarre..  I'm completely stumped..

By the way.. if you have any other french questions.. ask me.. I'm multilingual..  and live in Montreal.. and happen to be quite good with french :)
Alright, sure thing. I'm stumped too :-(

I'll keep thinking though, and if I come up with anything, I'll let you know.
OK.. I'll let you know what I come up with..  if nothing comes up soon, I'll throw you the points anyway.

Thanks man,
D
Well.. the hosting company basically copped out.. saying "if the person has the correct fonts installed it's OK" and they closed the ticket.. ;) what a joke..

They ignored everything I told them including the fact that I DO have the fonts installed and only have the problem with the HTML document when viewed online..  and not when viewed locally.

So..  I told them so and now I'm waiting for a response.. in the meantime..in order to get the site working ASAP, I'm going to use images instead of text.. something I hate doing.  I'll sub in the real text later if I find a solution.

I'll wait and see what they say and then otherwise.. close this question..

Unless of course someone else might know what's going on here?

D
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial