[fpc-pascal] Set of encoding conversion routines

Marco van de Voort marcov at stack.nl
Wed Aug 12 15:33:55 CEST 2009


In our previous episode, Felipe Monteiro de Carvalho said:
> On Tue, Aug 11, 2009 at 12:43 PM, Marco van de Voort<marcov at stack.nl> wrote:
> > The lowest level is unit charset in the rtl, Unix style iconv is supported
> > by package iconvenc.
> 
> The charset unit doesn't look complete or usable.

Afaik it is. The unit is just the main conversion, and can be plugged with
units that are generated directly from unicode.org tables.

Our own cache of those tables are in ucmaps, and the tool to make units out
of them is utils/creumap.pp. Examples for such units are compiler/cp*

The only problem is that it uses UTF16 internally iirc.
 
> > No. Non *nix OSes have their own api. There is an abstraction,
> > lconvencoding, but that is in the LCL afaik.
> 
> In the latest lazarus svn lconvencoding has real encoding conversion
> tables! I don't know if they all work 100%, but I managed to strip LCL
> dependencies and leave only the encoding I want and the conversion
> from UTF-8 to Latin 1 ISO worked perfectly.

Maybe expanding charset with a utf16<=>utf8 conversion, and making a package
with units with some common encodings would do it also.



More information about the fpc-pascal mailing list