473,485 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Character encoding after window.open()

2 New Member
Hi!

I have a small javascript snippet that does the following:

Expand|Select|Wrap|Line Numbers
  1. // an entire html document is in here
  2. data = "\u003c!DOCTYPE html PUBLIC \u0022-//W3C//DTD XHTML 1.1 Strict//EN\u0022\n  ...."; 
  3.  
  4. newwin = window.open("", "outputwin", "");
  5. newwin.document.write(data);
  6. newwin.document.close();
  7.  
Now, in the data variable, the character encoding is set to be UTF-8 using a meta http-equiv tag. Same for the page that contains this script.

When I look at the character encoding in the Firefox (2.0.0.3) "View Page Info" dialogue box, it tells me the following:

The original page has an Encoding of UTF-8 and the Content-type is text/html; charset=utf-8

The new page, however, has an Encoding of ISO-8859-1 but the Content-type is shown as text/html; charset=utf-8.

This is the case when there are non-ISO-8895-1 characters present although they are correctly displayed.

So...

* Is this something to be worried about?

* Is this something I can address in the javascript? (is there an optional argument to document.open that specifies the charset? I can't find one!)

* Is this instead a Firefox bug?

All thoughts and ideas appreciated.
Mar 26 '07 #1
2 15565
stup
2 New Member
Follow-up: saving the source of the file in Firefox and looking at it in a hexeditor, it looks like it's actually UTF-16/UCS-2.

Even more strange?
Mar 26 '07 #2
asc99c
1 New Member
Sorry to jump into your thread, but hey, free bump back up to the top!

I'm having the same problem but trying to use IBM850 character set. On a normal page, I send the following line in the header information (i.e. before the html tag):
Content-type: text/html; charset=IBM850

I can't do this when using Javascripts window.open. Firefox shows the encoding of a javascript popup window to be UTF-8. I've already tried adding the following line inside the HTML that is written to the javascript window:
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=IBM850">

This has no effect though. Any non-ASCII IBM850 characters are displayed wrongly in the popup window.
Mar 27 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
3456
by: Agnes | last post by:
In my .net ,i need to generate an xml file , however, user may input a chinese character, Then , the xml will got something unknow characters. the following is my code, Does anyone know how to...
2
8440
by: Anna Carr | last post by:
I had a project which was working until this morning and I keep getting the following error. Does anyone know what has happened and how I can fix it?? error message - There is an invalid...
2
3262
by: Guillermo Rosich Capablanca | last post by:
I have a problem with utf-8 enconding and I don't know what to do in order to make it work. I want to open a new window with excel data so the user can choose to save it local. Everything...
4
18991
by: Nick | last post by:
Hi, I am trying to output a string of chinese characters as a text file. When I open a file for writing from VB, the file is automatically set to UTF-8 encoding (can tell by opening the file...
18
4577
by: james | last post by:
Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits the "," and then copies the results into a listbox. The data also...
44
9409
by: Kulgan | last post by:
Hi I am struggling to find definitive information on how IE 5.5, 6 and 7 handle character input (I am happy with the display of text). I have two main questions: 1. Does IE automaticall...
3
3863
by: LiMBi | last post by:
Hi, Is there a way to encode "??????????? ??????????" to "¶ÒÁ¹Ô´¹Ö§¤Ð µÃ§·Õèà»ç¹" and vice versa. Thanks
9
2905
by: jraul | last post by:
1) Am I correct that C++ does not have a defined character set? In particular, a platform might not use the ASCII character set? 2) C++ supports wchar_t types. But again, this has no defined...
13
3852
by: =?Utf-8?B?YXVsZGg=?= | last post by:
i have come across a situation in my project where i read a text file with some characters greater than hex 0x7f. i need to write character (0xE0) to a new file as an exception. however when i...
0
7111
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,...
1
6820
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
7258
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
5410
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
4544
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3049
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3053
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1371
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
242
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.