[fpc-devel] Unicode and UTF8String

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Dec 1 22:00:20 CET 2008


On Mon, 1 Dec 2008 18:45:46 -0200
"Felipe Monteiro de Carvalho" <felipemonteiro.carvalho at gmail.com> wrote:

> On Mon, Dec 1, 2008 at 6:38 PM, Marco van de Voort <marcov at stack.nl>
> wrote:
> > In our previous episode, Graeme Geldenhuys said:
> > IOW, you give the programmer the choice about the type, instead of
> > forcing him an arbitrary one, based on your favorite platform.
> 
> This is the part I like about this approach. The most likely fixed
> encoding to be adopted would be UTF-16, and something not very nice
> would happen to Lazarus users in UNIXes:
> 
> LCL (UTF-8) ------> RTL (UTF-16) ---> Operating System (UTF-8)
> 
> 2 useless conversions.

The LCL is a visual component library. It's string speed is slow anyway.
Except maybe for TMemo.Lines and running through a big TreeView.

Same is true for file functions. The OS overhead checking for
permissions and the other file system issues makes even a triple
encoding/decoding a non issue. For example under Mac OS X the lazarus
IDE uses the CFString functions to compare a filename. This normalizes
the string each time. CompareFilenames is used easily hundred thousands
of time and no one said yet, that the IDE runs slowly under OS X.

It's a different thing for TStrings. Many algorithms need the O(1)
time accessing a Items[i].


Mattias




More information about the fpc-devel mailing list