[fpc-pascal] SetCodePage in older FPC 3.0.4

Tomas Hajny XHajT03 at hajny.biz
Wed May 29 13:38:58 CEST 2019


On 2019-05-29 12:19, Michael Van Canneyt wrote:
> On Wed, 29 May 2019, Michael Van Canneyt wrote:
>> On Wed, 29 May 2019, AlexeyT wrote:
>> 
>>>> FPC generally uses system library functions for the conversion, so 
>>>> it
>>> does not depend on the FPC version.
>>> 
>>> But FPC has such files. Are they used in SetCodePage code?
>>> 
>>> user at PC:~/fpcupdeluxe/fpcsrc/packages/rtl-unicode/src/inc$ ls cp*
>>> cp895.pas  cp932.pas  cp936.pas  cp949.pas  cp950.pas cpbuildu.pp
>>> 
>>> and
>>> 
>>> user at PC:~/fpcupdeluxe/fpcsrc/rtl/ucmaps$ ls
>> 
>> These files are not used, they predate the fpWidestring unit, they are 
>> for the
>> charset unit, which can be used to manually convert codepages.
> 
> Correction: if you use the fpwidestring unit, these charset units are 
> used.

Well, I believe that it's still a bit imprecise. ;-) My understanding is 
that a programmer deciding to use fpwidestring may decide on the set of 
character mappings to be supported out of the box in his program. That 
may be done in two ways. One is by including a unit for a particular 
character set (e.g. fpcsrc/rtl/charmaps/cp1252.pas or 
fpcsrc/packages/rtl-unicode/src/inc/cp932.pas) or a set of character 
sets (fpcsrc/rtl/charmaps/cpall.pas and/or 
fpcsrc/packages/rtl-unicode/src/inc/cpbuildu.pas) in the uses clause of 
one of the project source files. The other is by loading a binary file 
(install/unicode/charset/*.bcm) dynamically at runtime 
(LoadBinaryUnicodeMapping in fpcsrc/rtl/inc/charset.pp). Both the units 
and the binary files are generated from the *.txt files using tools 
included with FPC.

Tomas



More information about the fpc-pascal mailing list