Expat and JavaScript

Franky Braem <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
I'm porting expat to JavaScript (using SpiderMonkey, see my wxJS 
project). The application is in Unicode.
I have the following problem:

When I pass a normal JavaScript string (SpiderMonkey uses UTF-16) to a 
'print' method I don't have to do any conversions to write the data to 
stdout.
When I use a string generated by expat (it is build in UNICODE and 
creates data in UTF-16) I have to do a conversion before I can send the 
string to the 'print' method.
When I look at the expat string in debug mode, I see all weird Chinese 
characters. When I debug the normal JavaScript string, I see normal text.
Is there a conversion needed between SpiderMonkey and Expat?

Maybe this JavaScript code makes some things clearer:

p.parse('<tag1 attr="1" attr2="2"><child1>child</child1></tag1>', true);
if ( p.currentElement.name == "tag1")
{
 wxJS.print("Ok");
}
else
{
 wxJS.print("Not ok");
}
wxJS.print(p.currentElement.name);

The comparison always fails (all though the parsing in expat went fine)

Franky.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.