[Up][Next] Reference for unit 'System' (#rtl)

Unicode and codepage support

The system unit works with Short-, Ansi-, and UnicodeString routines for all string related operations.

Ansistrings are code-page aware, which means that code page information is associated with them. For most routines, the support for converting these code pages is natural. For some routines, care must be taken when converting from codepage-aware strings to widestring.

The codepage conversion support is influenced by the following variables:

Name Description
DefaultSystemCodePage Actual code page to use when CP_ACP is encountered
DefaultUnicodeCodePage Code page for new Unicode strings
DefaultFileSystemCodePage Codepage to use when sending strings to single-byte OS file system routines.
DefaultRTLFileSystemCodePage Codepage to use when receiving strings from single-byte OS file system routines.

The windows code page identifiers are used. There are 3 special codepage identifiers:

Name Description
CP_ACP Currently set default system codepage
CP_OEMCP OEM (console) code page (only on windows)
CP_NONE Indicates absence of code page information for a string

The following routines may perform code page conversions:

Name Description
LowerCase Return lowercase version of a string.
UpCase Convert a string to all uppercase.
GetDir Return the current directory
MkDir Create a new directory.
ChDir Change current working directory.
RmDir Remove directory when empty.
Assign Assign a name to a file
Erase Delete a file from disk
Rename Rename file on disk
Read Read from a text file into variable
ReadLn Read from a text file into variable and goto next line
Write Write variable to a text file or standard output
WriteLn Write variable to a text file or standard output and append newline
ReadStr Read variables from a string
WriteStr Write variables to a string
Insert Insert one string or dynamic array in another.
Copy Copy part of a string.
Delete Delete elements (characters) from a string or dynamic array.
SetString Set length of a string and copy buffer.

All these routines exist also in Unicode versions.

Note that for conversion of codepages and Unicode strings, a Unicode manager must be present. On windows, the system is used for this. On Unix, one of the fpwidestring or cwstring units must be used.

Documentation generated on: May 14 2021