Click to See Complete Forum and Search --> : Japanese embedded file encoding problems


sherpa
02-16-2006, 09:07 PM
Hi,
Could any kind expert offer advice...?

I'm having major problems getting a multilingual site to display properly. It requires pages in English, French and Japanese.
The pages are html/php pages which import text files into an iframe as their readable content using:
<iframe src="content/filename.txt">
These text files include text and html tags.

I have read many articles all over the web and also the link from another thread
http://www.cs.mcgill.ca/~aelias4/encodings.html

but am still unsure about different combinations of browser/html/php and text file encodings, and cannot get things working smoothly.

As far as I can tell, UTF-8 will be the best encoding as it allows for Japanese and English characters.

But there are 4 different encodings at play here:
1. the <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> declaration.
2. the encoding of the .php/.html page (as specified during the "save as" dialog of my text editor).
3. the encoding of the .txt text files to be included (as specified during the "save as" dialog of my text editor).
4. the encoding selected by the user to view the page.

I know that number 4 is out of my control, but how best to organise the others?

I thought everything should work if I simply use UTF-8 for everything (which would be ideal as all pages would be encoded the same). The text content with UTF-8 encoding looks fine in all languages within my text editor. But in my web browser the Japanese seems to run into problems with this. Sometimes the text displays gibberish with wrong encoding combinations, and in other cases I have the text characters looking fine but the html tags are shown in full (e.g. it displays '<a href="page2.txt"><img src="button.jpg"></a>' instead of just a clickable button).

So how does the encoding of embedded files work? For example, if my html page is encoded in a Japanese encoding and then I import a Western-encoded text file to the iframe, which encoding takes preceddence - how will the text file be displayed?

Do I have to use a single consistent Japanese encoding for the Japanese pages (for encodings 1, 2, and 3 above?) and then UTF-8 (or a Western encoding) for the English and French? This would seem to contradict the idea of UTF-8 being a good "catch-all" encoding.

Anyone with a clear suggestion as to the combination of encodings I should be using here....help most appreciated.

Thanks in advance.

sherpa
02-18-2006, 03:50 AM
A follow-up on this one - perhaps somebody can look at this code and help?

I've encoded nearly everything with UTF-8.

The iframe correctly seems to be displaying the text as an html page in Safari and IE with Japanese text looking good (if of course the user chooses UTF-8 encoding in view options). But in Firefox the iframe contents are displaying with the html tags included.

Some help on this would be really appreciated.

Thanks in advance.

Code is at:

http://www.endlessness.org/encoding/encodingvisible.php

Thanks....