[1] |
|
|||
Returns | Integer CodePage / <err> | |||
Description | Returns the system's code page | |||
Examples |
put xStr(#sysCP) --or: put _s().sysCP()
-- 1253 |
|||
Notes |
[3] |
|
|||
Returns | List / <err> | |||
#all | Return all supported CodePages. | |||
Description |
Returns a list containing the code page conversion tables installed to the system.
If the optional #all argument is used, the list will contain all code page tables - both installed and supported but not installed. |
|||
Examples |
put xStr(#cpList) --or: put _s().cpList()
-- [10000, 10006, 10007, 10010, 10017, 10029, 10079, 10081, 10082, 1026, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1361, 20127, 20261, 20866, 21866, 28591, 28592, 28594, 28595, 28597, 28599, 28605, 37, 437, 500, 737, 775, 850, 852, 855, 857, 860, 861, 863, 865, 866, 869, 874, 875, 932, 936, 949, 950, 28603, 65000, 65001] put xStr(#cpList, #all) -- [10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10010, 10017, 10021, 10029, 10079, 10081, 10082, 1026, 1047, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1361, 20000, 20001, 20002, 20003, 20004, 20005, 20105, 20106, 20107, 20108, 20127, 20261, 20269, 20273, 20277, 20278, 20280, 20284, 20285, 20290, 20297, 20420, 20423, 20424, 20833, 20838, 20866, 20871, 20880, 20905, 20924, 20932, 20936, 20949, 21025, 21027, 21866, 28591, 28592, 28593, 28594, 28595, 28596, 28597, 28598, 28599, 28605, 37, 38598, 437, 500, 51949, 50220, 50221, 50222, 50225, 50227, 50229, 52936, 57002, 57003, 57004, 57005, 57006, 57007, 57008, 57009, 57010, 57011, 708, 720, 737, 775, 850, 852, 855, 857, 858, 860, 861, 862, 863, 864, 865, 866, 869, 870, 874, 875, 932, 936, 949, 950, 28603, 54936, 65000, 65001] |
|||
Notes |
Windows: Code Pages can be added/removed from the Regional and Language options, advanced Tab.
Windows: When removing an installed code page, though the code page will not be included in the cpList , the cp will be valid for creating strings until the next system boot. |
[4] |
|
|||||||||||||
Returns | PropList / <err> | |||||||||||||
CP | Integer CodePage to return info for. | |||||||||||||
Description |
Returns a propList containing info for the CP code page. If CP is not a valid code page, or the operation fails, an <err> is returned.
If CP is zero, or non integer, info for the glbCP will be returned. When used on a string, and if no CP is passed, info for the string's code page will be returned. If used on strX, and CP is not defined, the command will return info for the strX's CP. result PropList Entries:
|
|||||||||||||
Examples |
put _s().cpInfo(1251) --or: put xStr(#cpInfo, 1251)
-- [#cp: 1251, #sysName: ANSI - Cyrillic, #netName: windows-1251, #maxBPC: 1, #sysNMC: ?, #lbtArr: []] put _s("abc", 1255).cpInfo(932) -- [#cp: 932, #sysName: ANSI/OEM - Japanese Shift-JIS, #netName: shift_jis, #maxBPC: 2, #sysNMC: ?, #lbtArr: [[129, 159], [224, 252]]] put _s("abc", 1255).cpInfo() -- [#cp: 1255, #sysName: ANSI - Hebrew, #netName: windows-1255, #maxBPC: 1, #sysNMC: ?, #lbtArr: []] |
|||||||||||||
Notes |
[5] |
|
|||
Returns | Integer / strX / <err> | |||
CP | Integer CodePage to set as the object's code page. | |||
Description |
get: When used with no arguments, returns the string's code page - same as accessing the .cp property.
set: When an integer CP is passed to the command, and if CP is a valid code page (or -1, for glbCP), strX's code page will be changed to CP. If CP is invalid, an <err> will be returned. Otherwise, the original strX will be returned to the command line. |
|||
Examples |
put _s("abc").cp()
-- 1253 put _s("abc").cp(1255).cp -- 1255 |
|||
Notes | When setting a new code page, the new value is applied to the original string object. The object's binary contents remain untouched, as opposed to e.g. using the str.toS(newCP) command, which will return a new object after performing data conversion. |
[6] |
|
|||
Returns | Integer / strX / <err> | |||
LC | Integer LocaleID. | |||
Description |
get: When used with no arguments, returns the first Locale ID compatible with the string's code page.
set: When an integer LC is passed to the command, the Xtra will try to find the CodePage that matches the Locale ID LC. If successful, it will set the result as the strX's code page, and the original strX will be returned to the command line. Like with setting the .cp(), the string's binary content is not affected by the .lc() command. |
|||
Examples |
put _s("abc", 1252).lc()
-- 1027 -- 1027 = hex0403 = Catalan put _s("abc", 1252).lc(1033).cp() -- 1033 = hex0409 = English US. -- 1252 Both Catalan and English US use the CodePage 1252 (ANSI - Latin I). 1027 is less than 1033, so 1027 is returned as the lc of a string whose code page is 1252. |
|||
Notes | The same code page may be used by more than one Locale IDs: a code page defines a character set, while a locale, a country-language pair. When instructed to return a locale, the Xtra will browse the available locales, and return the first one compatible with the strings' code page. |
[7] |
|
|||
#standard | #win (default) or #mac | |||
Returns | 0 / <err> | |||
Description | Returns a list containing all the available SBCS code pages. If the codepage of a specific language is not installed, unicode strings containing characters of that language cant be split to a list of SDS strings (toSL command). This affects mostly mac conversions, and older Windows platforms - all Windows SBCS code pages are installed by default on Win 2k and newer. | |||
Examples |
put _s().getSCPL() |
|||
Notes | Support for mac code pages is not installed by default on Windows machines. To add mac support, you'll have to add the desired code pages through the Regional Options in the Control Panel. |
[8] |
|
|||
Returns | 0 / <err> | |||
Description | The list of the supported CodePages is requested from the sustem upon initialization. At that time, special buffers are being created, in order to speed up the toSL command. If support for a codepage is added or removed, this command can be used to refresh internal lists, and rebuild and required buffers. | |||
Examples |
put _s().renewSCPL() -- 0 |
|||
Notes |