473,795 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ 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 15697
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
3489
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 solve it ?? Private Sub Init() With AMSXML ..Formatting = Formatting.Indented ..Indentation = 4 ..IndentChar = " " ..WriteStartDocument()
2
8462
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 character in the given encoding. Line 1, position 1. line highlighted in red = this.LoadLayout(this.GetType (), "Causeway_Reports.ForensicEvidenceDetails.rpx");
2
3282
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 works fine, the new window, the excel data appears, but, extended characters are wrong. I call the window from an aspx page using this:
4
19017
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 from notepad). However, when I open this file from a Chinese program that does not support unicode, garbage is displayed. So what I have to do is to first use Notepad to change the encoding of the file to ANSI encoding, then the file would be...
18
4635
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 has some different characters in it that I am trying to remove. The small a with two dots over it and the small y with two dots over it. Here is my code so far to remove the small y: Private Sub Button2_Click(ByVal sender As System.Object, ByVal...
44
9500
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 convert text input in HTML forms from the
3
3876
by: LiMBi | last post by:
Hi, Is there a way to encode "??????????? ??????????" to "¶ÒÁ¹Ô´¹Ö§¤Ð µÃ§·Õèà»ç¹" and vice versa. Thanks
9
2927
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 character set? For instance, it might not be a unicode character set?
13
3908
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 attempt to write this via "Console.Write" or "filestream.Write" it seems the value changes. most of the output file is in text mode. if i view the original file in binary mode i see the character i'm having issue with as "e0 00" but when i...
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10167
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7544
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6784
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4114
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 we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.