Skip to content

DefaultFileSystemCodePage

Codepage to use for filenames

Declaration

Source position: systemh.inc line 808

var
  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.

Remark

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

Name Description
DefaultRTLFileSystemCodePage Code page in which to return system-returned filenames
DefaultSystemCodePage Current system codepage.
SetMultiByteFileSystemCodePage Set codepage used when passing strings to OS single-byte file system APIs
TSystemCodePage System code page