[Freeassociation-devel] UTF-8 strings gets truncated
Mahesh Kumar
mayi.dev at gmail.com
Wed Oct 26 14:50:13 PDT 2011
Hi,
I found this problem when I was testing with Japanese strings.
In icalparser the function strstriplt splits or truncates a UTF8 string
incorrectly.
BTW it happens only in the Release builds.
Here is the sample hex bytes of an UTF-8 string I used for SUMMARY attribute
0x8e, 0xe4, 0xa5, 0xbd, 0xe5, 0xbb, 0xbd, 0xe6, 0x88, 0x83, 0xe7, 0x9d,
0x83, 0xe3, 0x9b, 0xb9, 0xe8, 0xa8, 0xbd, 0xe6, 0x98, 0xbd, 0xe3, 0xbb
Original String: 莠亥ョ壻ス懈・繝・せ繝茨シ托シ・
strstriplt truncates two characters at the beginning and one character at
the end.
After investigation I figured the isspace function is returning true for
these characters.
I have attached the fix I figured for this issue , which basically is to
type cast the input
parameter to isspace function to "unsigned char".
Thanks,
Mahesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/libical-devel/attachments/20111026/d1b181e8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: icalparser.c.patch
Type: application/octet-stream
Size: 657 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/libical-devel/attachments/20111026/d1b181e8/attachment.obj>
More information about the libical-devel
mailing list