Re: [xml] conversion from wchar_t
- From: Bevan Collins <b collins sentrybay com>
- To: Jonah Petri <jpetri izotope com>
- Cc: xml gnome org
- Subject: Re: [xml] conversion from wchar_t
- Date: Fri, 14 Jan 2011 12:44:39 +1300
On Debian sizeof(wchar_t) is indeed 4. Thanks Jonah!
On Fri, Jan 14, 2011 at 12:39 PM, Jonah Petri
<jpetri izotope com> wrote:
I can't say for sure - but check sizeof(wchar_t) on debian. If it's 4, then that's your answer. Just a hunch!
-Jonah
On Jan 13, 2011, at 6:17 PM, Bevan Collins wrote:
Please tell me what I am doing wrong:
#include <libxml/encoding.h>
#include <wchar.h>
int main()
{
xmlCharEncodingHandlerPtr utf16Enc = xmlFindCharEncodingHandler("UTF-16");
wchar_t* url = "" href="http://atest.com/" target="_blank">http://atest.com";
xmlBufferPtr in = xmlBufferCreateStatic(url, wcslen(url) * 2);
xmlBufferPtr out = xmlBufferCreate();
int rc = xmlCharEncInFunc(utf16Enc, out, in);
printf("rc=%d url="" rc, (char*)out->content);
xmlBufferFree(in);
xmlBufferFree(out);
return 0;
}
on Windows with version libxml2-2.7.7 I get:
rc=16 url="" href="http://atest.com/" target="_blank">http://atest.com
on i386 Debian with version libxml2-2.7.8 I get:
rc=16 url="">
It looks like on Debian that it has simply copied the input buffer into the output buffer:
url[0] = 'h'
url[1] = '\0'
url[2] = 't'
...
Thanks.
_______________________________________________
xml mailing list, project page
http://xmlsoft.org/xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]