[xml] UTF8ToHtml Umlaut bug?
- From: Steven Falken <btwotch googlemail com>
- To: xml gnome org
- Subject: [xml] UTF8ToHtml Umlaut bug?
- Date: Mon, 28 Mar 2011 01:37:50 +0200
Hi,
I wanna use http://xmlsoft.org/html/libxml-HTMLparser.html#UTF8ToHtml
and I have the following code:
-------------------------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <libxml/HTMLparser.h>
#define BUFSIZE 1024
int main()
{
char buf[BUFSIZE];
char *txt = "<>{}'Ãblabla";
int inlen, txt_len;
inlen = txt_len = strlen(txt);
int outlen;
int outdone = 0, indone = 0;
int ret;
printf("before: %s\n", txt);
do
{
outlen = 100;
inlen = txt_len - indone; printf("intxt: %s inlen:
%d\n", txt+indone, inlen);
ret = UTF8ToHtml((xmlChar*)buf, &outlen,
(xmlChar*)txt+indone, &inlen);
indone += inlen;
outdone += outlen;
printf("converted: %.*s (%d)\n", outlen, buf, outlen);
getchar();
} while(indone != txt_len);
}
-------------------------------------------------------------------------------
this works as normal, buf if you replace "outlen = 100;" with "outlen
= 4;" it hangs at converting the umlaut
(means outlen is set to zero after UTF8ToHtml).
Moreover, why isn't it converting '<' to '<'?
thx for your answer
P.S.: is there a htmlwriter in libxml2? I've only seen a xmlwriter.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]