Having a BOM for UTF-16 for Little Endian is required, it can be
present for Big Endian, an if there is no BoM present Big Endian is
assumed.  That is what The Unicode Consortium has to say about it
anyway. If there is no BOM there are other suggestions made by the xml
spec to determine various encodings indicating UTF-16, UTF-32, and one
or two others when there is no BoM.

In any case, as long as the resource is treated as a binary resource
when storing and retrieving it there should be no issue in VS. if the
XML is compliant because libxml2 takes care all of that transcoding
for you.  If you are asking if the editor handles UTF-16LE, yes it
does.

On Fri, Jun 4, 2010 at 2:14 AM, Richard Quadling <[email protected]> wrote:
> On 2 June 2010 16:41,  <[email protected]> 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/
>> [email protected]
>> http://mail.gnome.org/mailman/listinfo/xml
>>
>>
>
> Does/will/can the endian make a difference?
>
> My editor says the file is UTF-16 LE (Little Endian).
>
> Is having a BOM normal? Does the file need to be BE for VS?
>
>
>
>
>
>
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
> _______________________________________________
> xml mailing list, project page  http://xmlsoft.org/
> [email protected]
> 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/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to