[fpc-pascal] Delphi / FPC and UTF8 BOM

Martin Schreiber fpmse at bluewin.ch
Wed Oct 22 14:02:40 CEST 2008


On Wednesday 22 October 2008 13.31:41 Marco van de Voort wrote:
> In our previous episode, Martin Schreiber said:
> > > The solution has Windows written all over it (including viewer UTF-8 as
> > > a codepage), but it has merits IMHO.
> >
> > Are you sure about the encoding field for every string instance?
>
> Yes.
>
> > It could be done by compiler magic and an encoding field in the typeinfo
> > too?
>
> No, since then the runtime routines must be overloaded again, for each
> compiler magic'ed type (all codepages +UTF-8, and another two).
>
> A runtime routine must be able to detect what kind of string type it
> receives, or you need a runtime routine per type.

Or the compiler adds the conversion to the function call because at 
compiletime the encoding of both types are known. Delphi converts always to 
an intermediate utf-16 AFAIK.

Martin



More information about the fpc-pascal mailing list