std-sys-codepage | ![]() |
(std-sys-codepage <cp>) ; check or set system codepage
(std-codepage-available-p <cp>) ; check without an error if it is available
STD-SYS-CODEPAGE
gets and sets a STDLIB codepage.
On T the standard AutoCAD codepage is set, the value (GETVAR "SYSCODEPAGE")
.
On nil the actual stdlib codepage is returned.
On a new valid codepage string the new codepage is set and some string functions are redefined to work with the new codepage.
STD-CODEPAGE-AVAILABLE-P
is used to check if the codepage is defined without throwing an error.
A codepage is a table of ascii characters in a special and unique order, dependent on the system settings. Normally the AutoCAD system codepage (GETVAR "SYSCODEPAGE")
and the operating system codepage are the same, they don't need any translation. But sometimes you may want to maintain stringtables just in one codepage and automatically translate them to others. Or you may want to read in or write out strings in a different codepage.
Special treatment must be given to 8-bit extensions of foreign characters.
The internal stdlib codepage is iso8859-1 (Latin-1)
On changes the following low-level functions are redefined:
Character ranges: (LC_CTYPE)
STD-ISUPPER, STD-ISLOWER, STD-TOUPPER, STD-TOLOWER
Affected stdlib functions are furthermore:
STD-STRCASE, STD-STRING-UPCASE, STD-STRING-DOWNCASE, STD-STRING-CAPITALIZE
Changing the codepage with STD-SYS-CODEPAGE
changes the behaviour of those functions. Also affected is and maybe lateron some more string formatting and user input and output functions.
Codepage names may use common aliases.. We support the aliases defined in DBTRANS.CPM, all the aliases defined in the standard recode gnu tool for all supported codepages and some more RFC 1345 charsets. The name is a case-sensitive string!
All codepage names are unified to the names below.
The yet supported codepages for STD-CPTRANS are the following:
("iso8859-1" "ascii" "dos437" "dos850" "dos852" "dos855" "dos857" "dos860" "dos861" "dos863" "dos864" "dos865" "dos869" "iso8859-2" "iso8859-3" "iso8859-4" "iso8859-5" "iso8859-6" "iso8859-7" "iso8859-8" "iso8859-9" "mac-roman")
More cyrillic codepages are supported for character ranges (STD-TOUPPER, ...), in special:
("dos866" "koi-8r" "cp1251")
Missing are the 16-bit unicode codepages for asian languages like chinese, korean and japanese, unicode, and the charsets for STD-CPTRANS for the above defined cyrillic codepages which are not included in DBTRANS.CPM
For a detailed list of valid aliases see the STDLOCAL module. For a list of all unified names you may also call (STD-%CODEPAGES).
Exceptions
If a invalid codepage name or codepage alias is given to STD-SYS-CODEPAGE
an "invalid codepage" error is thrown. This might be a problem on dynamic codepage support. Therefore the special predicate STD-CODEPAGE-AVAILABLE-P
is provided.
cp: T or nil or a string, which must be a valid codepage name, case-sensitive.
A string, the unified name of the current codepage.
It may set a new stdlib codepage which redefines certain string functions.
It sets and reads the global variable *CODEPAGE*.
(std-require 'STDLOCAL)
Defined in STDLOCAL