How do I load and save a UTF-8 document in XML in ASP/VBS?
Well, the loading* is not the problem actually -- the file is in UTF-8,
and understood correctly -- but once saved, the UTF-8 is replaced by
what seems to be iso-8859-1 (which Flash doesn't understand, but that's
another problem). Any help greatly appreciated.
* Something like this...
set xDoc = server.createOb ject("Msxml2.DO MDocument")
xDoc.async = false
xDoc.load sPath 7 5001
Philipp Lenssen wrote: How do I load and save a UTF-8 document in XML in ASP/VBS?
Well, the loading* is not the problem actually -- the file is in UTF-8, and understood correctly -- but once saved, the UTF-8 is replaced by what seems to be iso-8859-1
* Something like this... set xDoc = server.createOb ject("Msxml2.DO MDocument") xDoc.async = false xDoc.load sPath
I am pretty sure if you then use
xDoc.save Server.MapPath( filename)
later then the encoding is preserved.
Are you by chance saving by writing xDoc.xml with the FileSystemObjec t?
The MSXML 4 docs say about the save method:
"Character encoding is based on the encoding attribute in the XML
declaration, such as <?xml version="1.0" encoding="windo ws-1252"?>. When
no encoding attribute is specified, the default setting is UTF-8."
which supports my view that the encoding the document has when being
loaded is preserved when saving.
--
Martin Honnen http://JavaScript.FAQTs.com/
Martin Honnen wrote: Philipp Lenssen wrote:
How do I load and save a UTF-8 document in XML in ASP/VBS? I am pretty sure if you then use xDoc.save Server.MapPath( filename) later then the encoding is preserved. Are you by chance saving by writing xDoc.xml with the FileSystemObjec t?
Thanks so far Martin, this is my save method:
xDoc.save server.mapPath( sPath)
So no, I'm not using the FSO...
Any idea what's happening?
--
Google Blogoscoped http://blog.outer-court.com
Philipp Lenssen wrote: Philipp Lenssen wrote:
How do I load and save a UTF-8 document in XML in ASP/VBS?
this is my save method:
xDoc.save server.mapPath( sPath)
You say the file is saved as iso-8859-1, does MSXML really save it with
that encoding and put a
<?xml version="1.0" encoding="iso-8859-1"?>
in there, or why do you think that MSXML saves as iso-8859-1?
--
Martin Honnen http://JavaScript.FAQTs.com/
Martin Honnen wrote: Philipp Lenssen wrote: Philipp Lenssen wrote:
> How do I load and save a UTF-8 document in XML in ASP/VBS? >
this is my save method:
xDoc.save server.mapPath( sPath)
You say the file is saved as iso-8859-1, does MSXML really save it with that encoding and put a <?xml version="1.0" encoding="iso-8859-1"?> in there, or why do you think that MSXML saves as iso-8859-1?
Let me put it this way. I use my own Netpadd editor, which doesn't
support UTF-8. I know because whenever I open UTF-8, I see this "i>?"
as first character. So when I want to open UTF-8, I use Notepad.
The files however that *were* UTF-8 when I put them in this tool which
I'm programming (a simple text translation tool), they are coming out
"fine" for my non-UTF-8 Netpadd once they are saved. So they lost their
"UTF-8ness" without me saying so in ASP!
Thanks so far, and hope you have more hints!
--
Google Blogoscoped http://blog.outer-court.com
UTF-8 does not by itself add special characters to the start of a file. If
the files are plain XML the first non-whitespace character should be "<".
Unicode files do have 2 special characters at the beginning.
What operating system are you running on when you open files in Notepad? The
version of notepad included with NT, Win2000, and WinXP Pro is capable of
saving files in ANSI, Unicode, or UTF-8
How are you opening the files from the ASP script? If possible show the
simplest *working* code (just read and then write the file) that duplicates
the problem along with a sample XML file.
--
--Mark Schupp
Head of Development
Integrity eLearning www.ielearning.com
"Philipp Lenssen" <in**@outer-court.com> wrote in message
news:35******** *****@individua l.net... Martin Honnen wrote:
Philipp Lenssen wrote:
> > Philipp Lenssen wrote: > > > > > > > How do I load and save a UTF-8 document in XML in ASP/VBS? > > >
> this is my save method: > > xDoc.save server.mapPath( sPath) >
You say the file is saved as iso-8859-1, does MSXML really save it with that encoding and put a <?xml version="1.0" encoding="iso-8859-1"?> in there, or why do you think that MSXML saves as iso-8859-1?
Let me put it this way. I use my own Netpadd editor, which doesn't support UTF-8. I know because whenever I open UTF-8, I see this "i>?" as first character. So when I want to open UTF-8, I use Notepad. The files however that *were* UTF-8 when I put them in this tool which I'm programming (a simple text translation tool), they are coming out "fine" for my non-UTF-8 Netpadd once they are saved. So they lost their "UTF-8ness" without me saying so in ASP!
Thanks so far, and hope you have more hints! -- Google Blogoscoped http://blog.outer-court.com
Philipp Lenssen wrote: Martin Honnen wrote:
You say the file is saved as iso-8859-1, does MSXML really save it with that encoding and put a <?xml version="1.0" encoding="i so-8859-1"?> in there, or why do you think that MSXML saves as iso-8859-1?
Let me put it this way. I use my own Netpadd editor, which doesn't support UTF-8. I know because whenever I open UTF-8, I see this "i>?" as first character. So when I want to open UTF-8, I use Notepad. The files however that *were* UTF-8 when I put them in this tool which I'm programming (a simple text translation tool), they are coming out "fine" for my non-UTF-8 Netpadd once they are saved. So they lost their "UTF-8ness" without me saying so in ASP!
Frankly to use a tool that doesn't understand UTF-8 to check whether a
file is UTF-8 encoded doesn't sound like a reliable way, it might simply
be a byte order mark at the beginning of the file and that mark is
optional in UTF-8.
I don't really how to help on that, I would use an XML parser to check
whether the file is properly encoded, simply loading the file in IE/Win
should do to check that.
If you have the application online then post a URL (or better two, one
to the original, one two the saved XML) then someone here could check
whether it is really UTF-8 or ISO-8859-1 what you get there.
--
Martin Honnen http://JavaScript.FAQTs.com/
Martin Honnen wrote: Philipp Lenssen wrote:
If you have the application online then post a URL (or better two, one to the original, one two the saved XML) then someone here could check whether it is really UTF-8 or ISO-8859-1 what you get there.
It's already solved, IIRC I posted this here already.
--
Google Blogoscoped http://blog.outer-court.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike Dee |
last post by:
A very very basic UTF-8 question that's driving me nuts:
If I have this in the beginning of my Python script in Linux:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
should I - or should I not - be able to use non-ASCII characters
in strings and in Tk GUI button labels and GUI window titles and in
raw_input data without Python returning wrong case in manipulated
|
by: Svennglenn |
last post by:
I'm working on a program that is supposed to save
different information to text files.
Because the program is in swedish i have to use
unicode text for ÅÄÖ letters.
When I run the following testscript I get an error message.
# -*- coding: cp1252 -*-
|
by: hilio |
last post by:
I have an asp application that should allow the user to enter Unicode
characters.
The characters appear correctly in the browser.
When saved in sql 2000 thought they are converted to question marks
etc.
When I enter the characters directly in SQL (using enterprise manager),
they appear correctly in sql as well as in the browser when the asp
page retrieves them.
As soon as I hit save they get overwritten in sql incorrectly.
|
by: Cesar Ronchese |
last post by:
Hello, All!
I'm working with accentuated characters in my XML files, and I have found
problems to load and save it.
First, for this case, I always have my XML in memory, and I load it via
LoadXML (please, ignore incorrect concatenations for this sample):
Dim cXml As New Xml.XmlDocument
|
by: THY |
last post by:
Hi,
I am developing a website in english & chinese both language. whenever I
save, it required I set the encoding in advanced save options. But I found
there are 4 related to unicode, can anyone tell me what's the different and
which to choose ?
Unicode (UTF-8 without signature) - Codepage 65001
Unicode (UTF-8 with signature) - Codepage 65001
Unicode - Codepage 1200
| |
by: Ersin Gençtürk |
last post by:
hi,
I am working with utf-8 encoded aspx files.But in visual studio.net 2003
when I make somechanges to a utf-8 aspx file and click save , it reverts the
encoding to another (win-1254) format.I have to use "save with encoding"
command in save dialog to succsessfully save it again in utf-8 format.I have
tried choosing this dialog every time.
I could not find an setting for default encoding for saving files.Is there
any setting that I...
|
by: Neil G Jarman |
last post by:
Hi,
I would like to save my user's passwords as an encrypted sting.
Are their built in functions for doing this?
It's not financial data or anything, just to keep away prying eyes.
many thanks,
|
by: =?Utf-8?B?Um9iZXJ0SGlsbEVEUw==?= |
last post by:
I have classic asp files (IIS6) that need to be saved in UTF-8 format. I
save a file with Notepad using SAVE-AS & UTF-8 format. If I reopen the file
using Notepad and bring up the save-as dialog is defaults to UTF-8, which is
good. But after the file is modified and saved using Visual Interdev the
format switches back to ANSI format, which causes some international
characters to display as little boxes in the browser. I found one...
|
by: Lucvdv |
last post by:
This would better be described by 'serialization' than 'interop', but I
didn't find a newsgroup that seems closer on topic.
The problem in a few words: I save data with DataSet.WriteXML, but I get
different data back when I read it later with DataSet.ReadXml.
More detail:
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |