Re: [xml] UTF-8 Conversion
- From: Tyler MacDonald <tyler yi org>
- To: Rush Manbert <rush manbert com>
- Cc: xml gnome org
- Subject: Re: [xml] UTF-8 Conversion
- Date: Fri, 28 Apr 2006 15:58:58 -0700
Tyler MacDonald <tyler yi org> wrote:
My result actually isn't that bad now, I'm just having to deal with
UTF-8 conversion (which is a bit of a pain).
Ok.. so in my test, the string is "Foo & Bar's Excellent Adventure".
I'm trying to inject it into a text node. No matter what I try, it
*doesnt* get injected into the node tree, and I get "output error : string
is not in UTF-8" or "xmlEscapeEntities : char out of range".
Here's my latest attempt. It says "xmlEscapeEntities : char out of
range" when I pass the string "Foo & Bar's Excellent Adventure" through the
"%s" handler in bt_data2xml below:
#define DATA2XML(s,t) if(!strcmp(description.format, s)) { sprintf((char*)__buffer, description.format,
*((t*)data)); }
xmlNodePtr bt_data2xml(xmlNodePtr parent, bt_xml_node description, void* data) {
xmlChar *holder;
int len = 200;
int inlen;
if(!strcmp(description.format, "%s")) {
holder = xmlCharStrdup((char*)data);
inlen = strlen(holder);
isolat1ToUTF8(__buffer, &len, holder, &inlen);
}
else DATA2XML("%llu", u_int64_t)
else DATA2XML("%lu", time_t)
else DATA2XML("%u", u_int32_t)
else {
__buffer[0] = 0;
fprintf(stderr, "Warning: %s is null: unknown format '%s'\n", description.name, description.format);
}
return xmlNewTextChild(parent, NULL, description.name, __buffer);
}
Any ideas?
Thanks,
Tyler
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]