Sign in Join
FPDoc Onlineexperiment

DefaultFileSystemCodePage variable

In unit System

Codepage to use for filenames.

Declaration

pascal
DefaultFileSystemCodePage: TSystemCodePage

Description

DefaultFileSystemCodePage determines the code page to which file/path names are translated before they are passed to OS API calls, if the RTL uses a single byte OS API for this purpose on the current platform.

This code page is also used for intermediate operations on file paths inside the RTL before making OS API calls.

This variable does not exist in Delphi, and has been introduced in FPC to make it possible to change the value of DefaultSystemCodePage without breaking RTL interfaces with the OS file system API calls.

The initial value of this variable depends on the platform:

  • Windows: UTF-8, because the RTL uses UTF-16 OS API calls (so no data is lost in intermediate operations).
  • OS X and iOS: UTF-8 (as defined by Apple)
  • Unix (excluding OS X and iOS): equals DefaultSystemCodePage. This is because the encoding of file names is undefined on Unix platforms: it is an untyped array of bytes that can be interpreted in any way; Specifically, it is not guaranteed to be valid UTF-8.
  • Other platforms: same as DefaultSystemCodePage.

The value of this variable may be changed using the SetMultiByteFileSystemCodePage procedure.

The Unix/OS X/iOS settings only apply in case the cwstring widestring manager is installed, otherwise DefaultFileSystemCodePage will have the same value as DefaultSystemCodePage after program startup.

See also

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