Sign in Join
FPDoc Onlineexperiment

DefaultRTLFileSystemCodePage variable

In unit System

Code page in which to return system-returned filenames.

Declaration

pascal
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 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.