[Lazarus] I cannot use System.Length() to calculate visible width of string, now !

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Jun 20 22:05:31 CEST 2008


On Thu, 19 Jun 2008 17:19:59 +0400
Андрей Гусев <ag888 at rambler.ru> wrote:

> Yes. But UTF8Length() is portable between string encodings?
> Solution is clean: i must use check ifdef'ed WindowsUnicodeSupport to
> choice between UTF8Length()/Length(). But maybe it already
> implemented as universal and conventional solution.
> 
> And, that adjanced questuion:
> Lazarus, guessed, have a tool to recognize encoding by binary 
> representation of string
> (because Lazarus automatically recognize encodings in LFM files), so, 
> how i can use it ?

There is a simple heuristic.
The function is in lcl/lconvencoding.pas function GuessEncoding.


Mattias




More information about the Lazarus mailing list