473,386 Members | 1,908 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,386 software developers and data experts.

Character encoding after window.open()

2
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 15525
stup
2
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
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
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
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
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
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
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
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
by: LiMBi | last post by:
Hi, Is there a way to encode "??????????? ??????????" to "ถามนิดนึงคะ ตรงที่เป็น" and vice versa. Thanks
9
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.