[Lazarus] substr return wrong string with some utf8 char

José Mejuto joshyfun at gmail.com
Fri Feb 11 14:35:19 CET 2011


Hello Lazarus-List,

Friday, February 11, 2011, 1:38:58 PM, you wrote:

>> Is it logical/safe that utf8 functions do not check utf8 integrity ?
>> I'm talking about utf8pos, utf8copy, etc...
LS> Maybe make the sanity check optional with default true ?
LS> Or some unit flag, default true and the utf* routines could force check
LS> if told so ?
LS> Not that I know anything about this code but why not let people who
LS> know what they are doing to skip the check or call check when they know they need to?
LS> (and as I said, in order not to break existing code, default would be to check always)

Current code does not perform sanity check, and I think most functions
should not perform it, only conversion functions and a "sanitize"
function should perform the checks, otherwise most functions will
degradate in speed even when you know that the data is utf8 compliant.
The same applies to UTF16.

-- 
Best regards,
 José





More information about the Lazarus mailing list