473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Japanese - wrong encoding in a frame

Hi,

May be it's a know issue but my search brought nothing...

We have static HTML files with Japanese text in UTF-8 encoding - it's
on-line Help for our application, so there are no Web servers involved,
just .html and .js on a hard drive.
..
Help topics are shown in a frameset (I know, I know, I personally had
no idea :)) like this (I made an example): http://RusWin.net/jindex.htm

Looks Ok in this example, each file involved has
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=utf-8">

But in this example the filese used in frames are hard-coded in
jindex.htm:

<FRAMESET ROWS="14%,76%,*">
<FRAME SRC="jheader.htm">
<FRAMESET COLS="29%,71%">
<FRAME SRC="jleft.htm">
<FRAME SRC="jmain.htm" NAME="page">
</FRAMESET>
<FRAME SRC="jfoot.htm">
</FRAMESET>

In a real system main frame shows gibberish instead of Japanese -
eventhough all browsers show (if I place cursor to the main frame and
use right mouse button to see current encoding) that currently selected
encoding for that piece _is_ UTF-8, the text is shown using "Western"
encoding :(

You can see that bad effect simulated if you go to
http://RusWin.net/jindex.htm, place cursor to the main frame and using
right mouse click choose "Western(Windows)" encoding - it's what we see
in real production system!

What is the difference with my example and the real system?

In real system HTML file with FRAMESET tag has _placeholders_
(blank.htm) afrer SRC= like this:

<frame name="" src="pagenav.htm" scrolling="no">
<frame name="" src="blank.htm" scrolling="no">
<frame name="" src="blank.htm" scrolling="auto">
and real file names are dynamically prepared using JavaScript
(re-direct happens):

WWHGetWWHFrame(ParamToBookDir)
........
location.replace(ParamToBookDir +
"wwhelp/wwhimpl/common/html/wwhelp.htm?context=" +
WWHBookData_Context() + "&file=" + BaseFilename);

*******************************

So does anyone know why re-direct (location.replace) can cause such
strange effect of a wrong encoding used?

*********************************************
We tried to avoid replacing whic removes file from frame first and
tried instead to use location to directly assign a file to the frame,
but it did not help:

newUrl = ParamToBookDir +
"wwhelp/wwhimpl/common/html/wwhelp.htm?context=" +
WWHBookData_Context() + "&file=" + BaseFilename;

location = newUrl;

*********************************************

Thanks,
Paul

Apr 21 '06 #1
3 2156

Hi,

It looks like a JavaScript issue - no problem without JavaScript,
issue appears only when we change a file name of HTML to be shown
in the main frame from a spaceholder Blank.htm to a needed one
dynamically using JavaScript function
location.replace()
or location = newUrl

with the same result - Japanese UTF-8 text is shown using "Western"
encoding (by both Firefox and Internet Explorer).

Anyone heard about such issue?

--
Regards,
Paul
Apr 21 '06 #2
Paul Gorodyansky wrote:
Hi,

It looks like a JavaScript issue - no problem without JavaScript,
issue appears only when we change a file name of HTML to be shown in
the main frame from a spaceholder Blank.htm to a needed one
dynamically using JavaScript function location.replace() or location
= newUrl

with the same result - Japanese UTF-8 text is shown using "Western"
encoding (by both Firefox and Internet Explorer).

Anyone heard about such issue?

This works correctly in both IE and Firefox.

I have created a page "frameset.html", with two frames, the second one
being named "hebrew" and loading a blank file, with the first frame
loading "western.html". I have created a page "western.html" thus:
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<p>This is the first frame.</p>
<p><input type="button" value="Replace"
onclick="parent.hebrew.location.replace('hebrew.ht ml');"></p>
<p> ל×� × ×™×ª×Ÿ ליצור ×�ת</p>
<p>That was hebrew</p>
</body>
</html>

That page is actually UTF-8 encoded, and the meta-tag lies. The garbled
characters are UTF-8, from the Hebrew alphabet.

I have a second file "hebrew.html" thus:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<p>Hebrew text follows</p>
<p>
ל×� × ×™×ª×Ÿ ליצור×�ת
</p>
<p>That was hebrew</p>
</body>
</html>

When I load "frameset.html" into a bruiser from the filesystem, the
garbage in the first appears to be garbage, as expected, and the second
frame displays nothing. When I click on the "Replace" button in the
first frame, the Hebrew text is loaded, and is correctly rendered as
Hebrew, as you would expect.

This behaviour is observed both with IE6 and Firefox. If I dick around
with the meta tag in either the frameset document or in "western.html",
the only change is that the Hebrew text is correctly rendered in the
latter when I change it to UTF-8. The display of "hebrew.html" is always
correct.

I initially tested all this without using framesets, because they just
complicate things. I can't read or write Hebrew; the Hebrew text was
found on a UTF-8-encoded webpage, and copied/pasted into a UTF-8-aware
text-editor.

Anyway, I conclude that there is nothing wrong with the handling by
location.replace() either of my meta-tags, or of UTF-8, in either of the
two bruisers that I tested.

Are you sure that your Japanese help-text is still correctly encoded in
UTF-8, and hasn't been damaged by some non-UTF-8-aware editor?

Are you perhaps using some more primitive bruiser? You haven't said
anything about your platform; these tests were carried out on a Win2K
machine configured to use ISO-8859-1 by default.

--
Jack.
Apr 21 '06 #3
Thanks, Jack!

We will look further, your tests will help.
--
Regards,
Paul
Apr 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Thomas | last post by:
Hi there, a while ago, I posted a question regarding reading japanese text from a text file. Well, since I solved the problem, I thought I'd post my solution for the benefit of other people with...
1
by: Sriv Chakravarthy | last post by:
I am trying to use xerces-c SAX parser to parse japanese characters. I have a <?xml... utf-8> line in the xml file. When the parser encounters the jap characters it throws a UTFDataFormatException....
2
by: Robert M. Gary | last post by:
I'm using JRE 1.5 on Solaris Japanese (Sparc). The JVM claims its default character set is EUC-JP I'm seeing two strange things when using Japanese character sets... 1) If I write a program that...
3
by: Benoit Martin | last post by:
in my windows app, I have some japanese text that I load from a text file and display on a label. No matter what type of encoding I try to use on the text file, the text always comes up as a bunch...
21
by: Doug Lerner | last post by:
I'm working on a client/server app that seems to work fine in OS Firefox and Windows IE and Firefox. However, in OS X Safari, although the UI/communications themselves work fine, if the...
11
by: prats | last post by:
I want to write a GUI application in PYTHON using QT. This application is supposed to take in Japanese characters. I am using PyQt as the wrapper for using QT from python. I am able to take input...
12
by: paulgor | last post by:
Hi, May be it's a know issue but my search brought nothing... We have static HTML files with Japanese text in UTF-8 encoding - it's on-line Help for our application, so there are no Web...
2
by: phl | last post by:
Hello, I have aspx(say page.aspx) page which uses javascript to submit a form reload with some unicode characters,upon an button event e.g page.aspx?param=value I get this value in the...
1
by: PHP Wooer | last post by:
Can anybody there please help me out? I am having a problem with the display of Japanese character in the subject line of the mails sent in Japanese language. This problem is particularly with...
1
by: sandeepindia | last post by:
I m using PHP Version 4.3.2 & Mysql version 3.23.58(No collation etc). My site is in shift JIS encoding. I've both japanese users & russian users. They have entered their member profile in their...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.