473,397 Members | 2,077 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,397 software developers and data experts.

charset in window created from javascript

Hello

I open a window from JavaScript with w=window.open,
write content with w.document.open,w.document.write,
w.document.close. I specified charset with
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-2">
but did not help much.
In Internet Explorer w.document.charset="ISO-8559-2"
after w.document.open solved the problem, but with Mozilla
this do not work. There is a w.document.characterSet, but
this is read only. Mozilla seems forcing UTF-8 - is there a way
to change this?
Jul 23 '05 #1
5 6948


LÅ‘rinczy Zsigmond wrote:

I open a window from JavaScript with w=window.open,
write content with w.document.open,w.document.write,
w.document.close. I specified charset with
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-2">
but did not help much.
In Internet Explorer w.document.charset="ISO-8559-2"
after w.document.open solved the problem, but with Mozilla
this do not work. There is a w.document.characterSet, but
this is read only. Mozilla seems forcing UTF-8 - is there a way
to change this?


I am not sure I understand the problem, once you are having script
writing to the page you are using JavaScript strings and these allow you
to use all Unicode characters directly or encoded
(String.fromCharCode(unicode), '\udddd')) so character set problems
shouldn't arise.
For instance the following writes the Euro symbol and a German umlaut to
the window just fine with Netscape 7.2:

var text = 'Der Preis ist 200€ über dem Limit.';
var win = window.open('', 'jsWin',
'width=300,height=300,scrollbars,resizable');
win.document.open();
win.document.write('<p>' + text + '<\/p>');
win.document.close();

In what way do you think Mozilla is "forcing UTF-8", how do figure that?

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Martin Honnen wrote:


LÅ‘rinczy Zsigmond wrote:

I open a window from JavaScript with w=window.open,
write content with w.document.open,w.document.write,
w.document.close. I specified charset with
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-2">
but did not help much.
In Internet Explorer w.document.charset="ISO-8559-2"
after w.document.open solved the problem, but with Mozilla
this do not work. There is a w.document.characterSet, but
this is read only. Mozilla seems forcing UTF-8 - is there a way
to change this?

I am not sure I understand the problem, once you are having script
writing to the page you are using JavaScript strings and these allow you
to use all Unicode characters directly or encoded
(String.fromCharCode(unicode), '\udddd')) so character set problems
shouldn't arise.
For instance the following writes the Euro symbol and a German umlaut to
the window just fine with Netscape 7.2:

var text = 'Der Preis ist 200€ über dem Limit.';
var win = window.open('', 'jsWin',
'width=300,height=300,scrollbars,resizable');
win.document.open();
win.document.write('<p>' + text + '<\/p>');
win.document.close();

In what way do you think Mozilla is "forcing UTF-8", how do figure that?


Well if I w.document.write ("Név") (three bytes) and I see "NÄ‚Å*v" in
Page Source (four bytes).
Jul 23 '05 #3


LÅ‘rinczy Zsigmond wrote:
Martin Honnen wrote:

In what way do you think Mozilla is "forcing UTF-8", how do figure that?

Well if I w.document.write ("Név") (three bytes) and I see "NÄ‚Å*v" in
Page Source (four bytes).


I see, so your problem is not with the rendered HTML in the browser
window but with the rendered source in view source? Or is there a
problem with the rendered HTML too?
I am going to search bugzilla on the view source problem, maybe that is
a known problem.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4


Martin Honnen wrote:

I am going to search bugzilla on the view source problem, maybe that is
a known problem.


Yes, it is a known problem:
https://bugzilla.mozilla.org/show_bug.cgi?id=161778

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #5
Martin Honnen wrote:


Martin Honnen wrote:

I am going to search bugzilla on the view source problem, maybe that
is a known problem.

Yes, it is a known problem:
https://bugzilla.mozilla.org/show_bug.cgi?id=161778

Yes it is the same problem. Thank you!
Jul 23 '05 #6

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

Similar topics

13
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
10
by: Marshall Dudley | last post by:
When I do the following line in Netscape, the popup loads as it should, but the parent window usually, but not always, reloads as well. <a href="#"...
32
by: Eli | last post by:
How can I POST a form into a new window where I control the size and other attributes of the new window? Also. Are there any implications, perhaps due to browser security (Interne Explorer?)...
6
by: news.versatel.de | last post by:
Hello NG, I am using javascript to open a new window like this: printpreview=window.open('printview.php','printprev','width=600,height=600'); The new window has a layer called preview: ...
4
by: Todd | last post by:
A window may or may not be created by me and JavaScript. When the "OK" button is pressed, I do a JavaScript Close(), but I want to make that conditional on whether the user is in a window called...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
7
by: multicherry | last post by:
Hi, Having searched for a way to fetch a window object by name, all I came across were answers along the line of... "All you have to do is say windowObj = window.open("blah", "name");" which...
2
by: KC | last post by:
Hi, Every JavaScript executive context has a top-level window and we can use window.open() to open another window ... Does this related to Windows created by click on "File"->"New Window" or...
2
by: Steve | last post by:
I want to open a window that has been pre-formatted with a table and then write rows to the table. The pre-formatted url is named budget.html and the body looks like this: <body> <h1...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.