[fpc-devel] UTF8Encode widestring encoding

JoshyFun joshyfun at gmail.com
Tue Aug 26 13:47:17 CEST 2008

Hello Felipe,

Tuesday, August 26, 2008, 12:28:45 PM, you wrote:

FMdC> I read the code for UTF8Encode and UTF8Decode routines and they seam
FMdC> to suppose that the widestring encoding is UCS-2! Instead of UTF-16
FMdC> Is this the expected behavior or is it only partially implemented?
FMdC> Someone added UTF8 <-> UTF16 conversion routines in the LCL, so they
FMdC> could be used to repair UTF8Encode / Decode.


The LCL implementation of UTF8ToUTF16 (default one) does not pass the
UTF8 stress test. My version does not handle UTF16 intentionally as
the proposed replace function can not make grow the widestring which
comes allocated, but... hmmm... oh! it comes at 2*bytes in UTF8, so
there must be space always to fit any character even the doubles ones.

:) It's time to add the UTF16 to my code.

Best regards,

More information about the fpc-devel mailing list