After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 377544 - UTF8ToHtml returns -2 error on valid UTF-8
UTF8ToHtml returns -2 error on valid UTF-8
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2006-11-20 21:51 UTC by Steve Rainwater
Modified: 2006-11-23 16:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to allow UTF8ToHtml to return numerical character references (1009 bytes, patch)
2006-11-20 21:58 UTC, Steve Rainwater
none Details | Review

Description Steve Rainwater 2006-11-20 21:51:27 UTC
Please describe the problem:
UTF8ToHtml() fails with error -2 if the input is valid UTF-8 and contains at least one character for which a named character entity doesn't not exist in the libxml2 entity table. I will provide a patch to fix the problem by substituting a numerical character value when a named entity is not available.

Steps to reproduce:
1. Call UTF8ToHtml with a UTF8 string containing a Han ideograph Chinese character
2. 
3. 


Actual results:
UTF8ToHtml returns a -2 error 

Expected results:
UTF8ToHTML should return an encoded ASCII encoded output equivalent to the UTF-8 input.

Does this happen every time?
yes

Other information:
Comment 1 Steve Rainwater 2006-11-20 21:58:30 UTC
Created attachment 76943 [details] [review]
Patch to allow UTF8ToHtml to return numerical character references

As per my post to the libxml2 mailing list, this patch fixed the problem for me. I have attempted to make the code and variable names consistent with other HTMLparser.c functions. This patch was made against HTMLparser.c as it existed in CVS on 20 Nov 2006.
Comment 2 Daniel Veillard 2006-11-23 16:18:13 UTC
Makes sense, applied and commited,

  thanks a lot !

Daniel