Solved

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

Posted on 2006-11-22
31
144 Views
Last Modified: 2010-04-09
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
0
Comment
Question by:Dionysus
  • 18
  • 10
  • +1
31 Comments
 
LVL 30

Expert Comment

by:irwinpks
Comment Utility
The server is not using the same character set as the local machine.
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
OK..the PHP was not the problem.. it was the XML coding I tried.. the PHP header function does nothing at all... same problem.. :(
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
this also begs the question, why does declaring my xml encoding make the page display blank?
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
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?
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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..
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
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.
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
Interesting. If you manually change your browser to display in big5, does it work?
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
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.
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
That's a good point.. I'll try that on my own hosting package.. see what happens..

I'll be back..

D :)
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
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.
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
Hey.. could it be because I'm using fonts in the CSS? Or would encoding overrride that?

D
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
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.
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
Yes, fonts are a big possibility! The encoding would not overwrite anything. Try reverting to just Arial and see how it goes.
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
Nope.. makes no difference.
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
:( Thought I had found something there!

Your enthusiasm and participation is helping though :)
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
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
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
Yes, it looks completely fine in both IE and FF. I even tried changing the font, and it was unfazed.
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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 :)
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
Alright, sure thing. I'm stumped too :-(

I'll keep thinking though, and if I come up with anything, I'll let you know.
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
 
LVL 1

Author Comment

by:Dionysus
Comment Utility
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
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now