[fpc-pascal] Unicode file routines proposal

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Tue Jul 1 13:54:36 CEST 2008


On Tue, Jul 1, 2008 at 4:23 AM, Marco van de Voort <marcov at stack.nl> wrote:
> Certainly. Can you imagine loading a non trivial file in a tstringlist and
> saving it again and the heaps of conversions?

And how do you know that the file to be loaded will be in the system
encoding? We should simply not do any conversion or any assumption
when loading a file in a TStringList, so nothing changes here.

We are talking about strings like the filename in LoadFromFile, and
not about the string to hold the contents. This would always be an
ansistring and if someone needs to load a utf-16 file he needs to
build a TWideStringList.

> Moreover, there is an important reason missing:
>
> * Being able to declare the outside world in the right encoding, without
>  manually inserting conversions in each header.

This has nothing to do with this. With a fixed encoding you can also
have automatic conversions.

I bet you would convert automatically from whatever to ansi when going
to a ansistring, but Lazarus uses utf-8 in ansistrings.

We do manual conversions in Lazarus because FPC misses a solution for
automatic conversion using utf-8 in ansistrings.

-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list