Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: SAX Via MSXML3.DLL XML Character encoding >Thread Next - Re: SAX Via MSXML3.DLL XML Character encoding Re: SAX Via MSXML3.DLL XML Character encodingTo: NULL Date: 5/4/2006 6:25:00 AM
"Umut Alev - MSFT" <ualev@h...> wrote in
news:nKj6g.1719$Th.461@trnddc03:
> Actually, all you have to do here is set the encoding on the writer
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk
> /html/c7ecffcd-ea6f-40a6-956a-dc2e15b70bbb.asp?frame=true
>
> for more info.
>
> Regards,
> Umut Alev - MSFT
Which funnily enough says "The encoding property has no effect for BSTR
or DOM output." :)
Anyway I have moved on from there.
I have just tried to use the ADODB Stream object as the IStream
implementation to write out to, but I am getting some strange results.
I am using C++, and so I did the following:
m_stream->Open(vtMissing,adModeUnknown,adOpenStreamUnspecified,_bstr_t(),
_bstr_t());
//m_wrt->encoding = _bstr_t("UTF-8");//Not present for first stream test
m_wrt->output = (IDispatch*)m_stream;
< Some other stuff>
m_stream->SaveToFile("c:\\temp\\test.xml",ADODB::adSaveCreateOverWrite);
This worked fine and test.xml looked O.K but at this stage the encoding
was still UTF-16.
When I added : m_wrt->encoding = _bstr_t("UTF-8");
The character encoding declaration suddenly had the hex bytes FF EE, at
the beginning.
I find this strange as that is the byte order mark for UTF-16.
If I use : m_wrt->encoding = _bstr_t("UTF-16");
Then it disappears. When using UTF-8 I even tried turning off
byteOrderMark, by assingining the property VARIANT_TRUE.
Still I have these bytes at the beginning.
Peter
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
