Re: [xml] New user - UTF-16 issue
- From: James Hart <beeblebrox42 gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] New user - UTF-16 issue
- Date: Wed, 2 Jun 2010 10:36:16 -0600
I see, you said the resource has wide characters to begin with. Do
you have a requirement that the resource must be stored encoded as
wide characters? My suggestion is that you reload your resource into
the visual studio editor and you should have the option when you are
saving it to encode it into UTF16. Then save the properly encoded
resource into your project. Then when you load the resource in the
program as a binary resource you will have no need to convert it from
wide characters to utf16 before handing it off to libxml2. Otherwise
you will need to lookup the Visual Studio's localization functions for
converting wide character data into UTF16 before handing it off to
libxml2.
~James
On Wed, Jun 2, 2010 at 10:20 AM, <Ramsundar_Govindaraj dell com> wrote:
Yes, I did that. I get an XML not well formed error if I do that.
Thanks for replying!
-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On Behalf Of James Hart
Sent: Wednesday, June 02, 2010 11:17 AM
Cc: xml gnome org
Subject: Re: [xml] New user - UTF-16 issue
Can't you load it as a binary resource and pass the binary array cast
to char * to libxml2 instead?
On Wed, Jun 2, 2010 at 9:41 AM, <Ramsundar_Govindaraj dell com> wrote:
Hi,
I know this issue might have been asked a thousand times over, but I am
not able to resolve the issue. My situation is this.
1. I have an xml file called b.xml whose encoding attribute is UTF-16.
(attached along with this email)
2. I embed this file as a resource into my visual studio project.
3. When the project starts up, I read this file into a variable and
need to pass it to Libxml2 to parse. How do I accomplish it?
The problems:
1. I cannot read the file into a char* as this file contains wide
characters. So I load them on to a wstring. After which I realized Libxml2
constraints of not allowing wchar strings. So I am trying to convert my
wchar* to char* .
2. Again I have 2 options here : either bad cast it or use
WidetoMultiByte to convert to char*. I did both of them.
3. After this, I called XmlReadMemory API in which I understand I can
specify the encoding. I gave NULL and UTF-16 in 2 separate attempts.
4. At the end of it, I cannot correctly parse and I get a NULL
xmlDocPtr. Any ideas on how should I go about solving this?
Thanks,
Ram
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
--
If there is anything bigger than my ego around, I want it caught and shot now!
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
--
If there is anything bigger than my ego around, I want it caught and shot now!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]