Skip to content

DefaultRTLFileSystemCodePage

Code page in which to return system-returned filenames

Declaration

Source position: systemh.inc line 811

var
  DefaultRTLFileSystemCodePage : TSystemCodePage;

Description

DefaultRTLFileSystemCodePage determines the code page to which file/path names are translated before they are returned from RawByteString file/path RTL routines.

Examples include the file/path names returned by the RawbyteString versions of SysUtils.FindFirst and GetDir .

The main reason for its existence is to enable the RTL to provide backward compatibility with earlier versions of FPC, as these always returned strings encoded in whatever the OS' single byte API used (normally DefaultSystemCodePage ).

The initial value of this variable depends on the platform:

Windows: DefaultSystemCodePage, for backward compatibility. OS X and iOS: UTF-8, for backward compatibility. It was already always UTF-8 in the past, since that's what the OS file APIs returned, and the data was never converted. Other Unixes: DefaultSystemCodePage, for the same reason as DefaultFileSystemCodePage . Setting this to a different value than DefaultFileSystemCodePage is a bad idea on these platforms, since any code page conversion can corrupt these strings as their initial encoding is unknown. Other platforms: same as DefaultSystemCodePage.

The value of this variable can be set using the SetMultiByteRTLFileSystemCodePage call.

See also

Name Description
DefaultFileSystemCodePage Codepage to use for filenames
DefaultSystemCodePage Current system codepage.
SetMultiByteRTLFileSystemCodePage Set codepage used when interpreting strings from OS single-byte file system APIs
TSystemCodePage System code page