[Freeassociation-devel] UTF-8 strings gets truncated

Allen Winter winter at kde.org
Thu Oct 27 12:00:07 PDT 2011


On Wednesday 26 October 2011 02:50:13 PM Mahesh Kumar wrote:
> 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 for the patch Mahesh.
I committed it with revision 1109.

-Allen




More information about the libical-devel mailing list