1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

applied patch from Steven Rainwater to fix UTF8ToHtml behaviour on code

* HTMLparser.c: applied patch from Steven Rainwater to fix
  UTF8ToHtml behaviour on code points which are not mappable to
  predefined HTML entities, fixes #377544
Daniel
This commit is contained in:
Daniel Veillard
2006-11-23 16:18:30 +00:00
parent fe3970e09f
commit 1032ac4c5c
2 changed files with 14 additions and 6 deletions

View File

@ -1,3 +1,9 @@
Thu Nov 23 17:22:03 CET 2006 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c: applied patch from Steven Rainwater to fix
UTF8ToHtml behaviour on code points which are not mappable to
predefined HTML entities, fixes #377544
Thu Nov 23 17:11:23 CET 2006 Daniel Veillard <daniel@veillard.com>
* xpath.c: fixed a bug where the principal node type of an axis

View File

@ -1842,6 +1842,8 @@ UTF8ToHtml(unsigned char* out, int *outlen,
} else {
int len;
const htmlEntityDesc * ent;
const char *cp;
char nbuf[16];
/*
* Try to lookup a predefined HTML entity for it
@ -1849,16 +1851,16 @@ UTF8ToHtml(unsigned char* out, int *outlen,
ent = htmlEntityValueLookup(c);
if (ent == NULL) {
/* no chance for this in Ascii */
*outlen = out - outstart;
*inlen = processed - instart;
return(-2);
snprintf(nbuf, sizeof(nbuf), "#%u", c);
cp = nbuf;
}
len = strlen(ent->name);
else
cp = ent->name;
len = strlen(cp);
if (out + 2 + len >= outend)
break;
*out++ = '&';
memcpy(out, ent->name, len);
memcpy(out, cp, len);
out += len;
*out++ = ';';
}