[fpc-pascal] Unicode file routines proposal

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Tue Jul 1 14:42:23 CEST 2008


On Tue, Jul 1, 2008 at 9:21 AM, Marco van de Voort <marcov at stack.nl> wrote:
> Well, euh, the main reason is that euh, most programs and data on the system uses
> the system encoding?

So you are saying that FPC should privilege platform-specific software
development to cross-platform software development? This is in the
inverse direction of all other cross-platform development platforms in
existence.

If you are writting cross-platform software you will wish to avoid as
much as possible the system routines, and a known encoding is good.

Florian's proposal shines here. You get the string with no conversion
and a marker for the encoding, so you can convert it to whatever you
want easily.

But it doesn't solve the TStringList problem, because there you have
no parameters to know the encoding of the file being loaded.

> Then I'd say you convert. But that is the point. The need for conversion should be
> the exception (different from the default system encoding), not the rule.

I think there should be no conversion at all (unless explicitly asked)
in the contents of the stringlist.

>> In my system I propose that simply a TWideStringList be implemented,
>> so both ways of storing data are available everwhere.
>
> But I don't have an utf-8 type in your system to operate on.

How do you know what I want to do with the data? What if I just want
to use some string routines in it to extract data? Or save them back
to another file? (or any operations which don't involve system
routines which need a specific string encoding)

-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list