How to read utf-8 xml from vbs and get correct character code
Posted
by vkjr
on Stack Overflow
See other posts from Stack Overflow
or by vkjr
Published on 2010-04-27T15:37:29Z
Indexed on
2010/04/27
16:03 UTC
Read the original article
Hit count: 428
I'm trying to read xml file from vbs script. Xml is encoded in utf-8 and has appropriate header
From vbs script I use microsoft xmldom parser to read xml:
Dim objXMLDoc
Set objXMLDoc = CreateObject( "Microsoft.XMLDOM" )
objXMLDoc.load("vbs_strings.xml")
Inside xml I'm trying to write character by code using &#nnn;
notation. Then I read this character from vbscript and try to get it's code using Asc()
function. For some characters it works fine and read code is equal to one written. But for some characters Asc()
always returns code 63
. What could it be?
Examples:
If xml contains <section>Ã<section>
and in script I have Section
variable for representing this xml node then code:
Asc(Section.Text)
will return value 195 and it's ok
.
If xml contains <section>n<section>
then code:
Asc(Section.Text)
will return value 110 and it's ok
.
But if xml contains <section>‚<section>
or <section>œ<section>
or <section>Œ<section>
Asc(Section.Text)
will return value 63 and it's definitely not good.
Do you know why?
© Stack Overflow or respective owner