Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > charset in window created from javascript

Reply
Thread Tools

charset in window created from javascript

 
 
Lõrinczy Zsigmond
Guest
Posts: n/a
 
      12-04-2004
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?
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-04-2004


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/
 
Reply With Quote
 
 
 
 
Lőrinczy Zsigmond
Guest
Posts: n/a
 
      12-04-2004
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).
 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      12-04-2004


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/
 
Reply With Quote
 
Lőrinczy Zsigmond
Guest
Posts: n/a
 
      12-05-2004
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript charset <> page charset optimistx Javascript 2 08-15-2008 12:42 PM
Diff between the window created by JavaScript and Browser GUI KC Javascript 2 12-12-2006 06:15 AM
OleDbDataAdapter created in code behaves differently from one created by wizard. tom c ASP .Net 6 09-06-2006 04:46 PM
are the objects created in the stack guarranted to have been created? jimjim C++ 12 06-03-2005 12:57 PM
schemalocation entry in XML created by castor created sources? Ulf Heyder XML 0 10-16-2003 02:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57