[fpc-pascal] SetCodePage in older FPC 3.0.4
Jonas Maebe
jonas at freepascal.org
Wed May 29 08:53:39 CEST 2019
On 2019-05-29 00:58, Alexey Tor. wrote:
> I am making small unit https://github.com/alexey-t/aencoding
>
> so I need to know:
>
> a) will it work on FPC 3.0.4? do I need to use {$ifdef}?
It will probably (not) work the same under FPC 3.0.4 and trunk. No
guarantees though.
> b) my trick to set CP_UTF8 at the end of nnnnFromTo function is ok?
It's not ok. It will at leas break when trying to write such a string,
or when assigning it to a unicodestring or widestring, or when assigning
it to a typed ansistring with a different code page than UTF-8 or
DefaultSystemCodePage.
> c) what encoding numbers (e.g. 936, 950) exist in FPC 3.3 but didn't
> exist in FPC 3.0.4?
FPC generally uses system library functions for the conversion, so it
does not depend on the FPC version. The only exception is if you use the
fpwidestring unit. In that case, the supported code pages depend on
which extra units from packages/rtl-unicode you include. I don't know
which code page(s) it supports by default.
Jonas
More information about the fpc-pascal
mailing list