recode()
The function converts a string and returns the string in the desired encoding.
Synopsis
string recode(string s, string sourceEncoding, [string
targetEncoding]);
Parameters
Parameter | Meaning |
---|---|
s | A string that is converted. |
sourceEncoding | The source encoding. |
targetEncoding | The target encoding. The target encoding. The default target encoding is the project encoding. |
Return value
The converted string.
Description
The function converts a string and returns the string in the desired encoding.As of the version 3.18 ISO projects cannot be created anymore. Create UTF-8 projects instead.
Possible Encodings
- ISO-8859-1
- latin1
- CP819
- IBM819
- iso-ir-100
- csISOLatin1
- UTF-8
- windows-1252
- ibm-5348_P100-1997
- ibm-5348
- cp1252
- UTF-8
- ibm-1208
- ibm-1209
- ibm-5304
- ibm-5305
- ibm-13496
- ibm-13497
- ibm-17592
- ibm-17593
- windows-65001
- cp1208
- x-UTF_8J
- unicode-1-1-utf-8
- unicode-2-0-utf-8
- UTF-16
- ISO-10646-UCS-2
- ibm-1204
- ibm-1205
- unicode
- csUnicode
- ucs-2
- UTF-16BE
- x-utf-16be
- UnicodeBigUnmarked
- ibm-1200
- ibm-1201
- ibm-13488
- ibm-13489
- ibm-17584
- ibm-17585
- ibm-21680
- ibm-21681
- ibm-25776
- ibm-25777
- ibm-29872
- ibm-29873
- ibm-61955
- ibm-61956
- windows-1201
- cp1200
- cp1201
- UTF16_BigEndian
- UTF-16LE
- x-utf-16le
- UnicodeLittleUnmarked
- ibm-1202
- ibm-1203
- ibm-13490
- ibm-13491
- ibm-17586
- ibm-17587
- ibm-21682
- ibm-21683
- ibm-25778
- ibm-25779
- ibm-29874
- ibm-29875
- UTF16_LittleEndian
- windows-1200
- UTF-32
- ISO-10646-UCS-4
- ibm-1236
- ibm-1237
- csUCS4
- ucs-4
- UTF-32BE
- UTF32_BigEndian
- ibm-1232
- ibm-1233
- ibm-9424
- UTF-32LE
- UTF32_LittleEndian
- ibm-1234
- ibm-1235
- UTF-7
- windows-65000
- unicode-1-1-utf-7
- unicode-2-0-utf-7
- SCSU
- ibm-1212
- ibm-1213
- BOCU-1
- csBOCU-1
- ibm-1214
- ibm-1215
- CESU-8
- ibm-9400
- ISO-8859-1
- ibm-819
- IBM819
- cp819
- latin1
- 8859_1
- csISOLatin1
- iso-ir-100
- ISO_8859-1:1987
- l1
- 819
- US-ASCII
- ASCII
- ANSI_X3.4-1968
- ANSI_X3.4-1986
- ISO_646.irv:1991
- iso_646.irv:1983
- ISO646-US
- us
- csASCII
- iso-ir-6
- cp367
- ascii7
- 646
- windows-20127
- ibm-367
- IBM367
- gb18030
- ibm-1392
- windows-54936
- GB18030
- ibm-912_P100-1995
- ibm-912
- ISO-8859-2
- ISO_8859-2:1987
- latin2
- csISOLatin2
- iso-ir-101
- l2
- 8859_2
- cp912
- 912
- windows-28592
- ibm-913_P100-2000
- ibm-913
- ISO-8859-3
- ISO_8859-3:1988
- latin3
- csISOLatin3
- iso-ir-109
- l3
- 8859_3
- cp913
- 913
- windows-28593
- ibm-914_P100-1995
- ibm-914
- ISO-8859-4
- latin4
- csISOLatin4
- iso-ir-110
- ISO_8859-4:1988
- l4
- 8859_4
- cp914
- 914
- windows-28594
- ibm-915_P100-1995
- ibm-915
- ISO-8859-5
- cyrillic
- csISOLatinCyrillic
- iso-ir-144
- ISO_8859-5:1988
- 8859_5
- cp915
- 915
- windows-28595
- ibm-1089_P100-1995
- ibm-1089
- ISO-8859-6
- arabic
- csISOLatinArabic
- iso-ir-127
- ISO_8859-6:1987
- ECMA-114
- ASMO-708
- 8859_6
- cp1089
- 1089
- windows-28596
- ISO-8859-6-I
- ISO-8859-6-E
- x-ISO-8859-6S
- ibm-9005_X110-2007
- ibm-9005
- ISO-8859-7
- 8859_7
- greek
- greek8
- ELOT_928
- ECMA-118
- csISOLatinGreek
- iso-ir-126
- ISO_8859-7:1987
- windows-28597
- sun_eu_greek
- ibm-5012_P100-1999
- ibm-5012
- ISO-8859-8
- hebrew
- csISOLatinHebrew
- iso-ir-138
- ISO_8859-8:1988
- ISO-8859-8-I
- ISO-8859-8-E
- 8859_8
- windows-28598
- hebrew8
- ibm-920_P100-1995
- ibm-920
- ISO-8859-9
- latin5
- csISOLatin5
- iso-ir-148
- ISO_8859-9:1989
- l5
- 8859_9
- cp920
- 920
- windows-28599
- ECMA-128
- turkish8
- turkish
- iso-8859_10-1998
- ISO-8859-10
- iso-ir-157
- l6
- ISO_8859-10:1992
- csISOLatin6
- latin6
- ibm-921_P100-1995
- ibm-921
- ISO-8859-13
- 8859_13
- windows-28603
- cp921
- 921
- x-IBM921
- iso-8859_14-1998
- ISO-8859-14
- iso-ir-199
- ISO_8859-14:1998
- latin8
- iso-celtic
- l8
- ibm-923_P100-1998
- ibm-923
- ISO-8859-15
- Latin-9
- l9
- 8859_15
- latin0
- csisolatin0
- csisolatin9
- iso8859_15_fdis
- cp923
- 923
- windows-28605
- ibm-943_P15A-2003
- ibm-943
- Shift_JIS
- MS_Kanji
- csShiftJIS
- windows-31j
- csWindows31J
- x-sjis
- x-ms-cp932
- cp932
- windows-932
- cp943c
- IBM-943C
- ms932
- pck
- sjis
- ibm-943_VSUB_VPUA
- x-MS932_0213
- x-JISAutoDetect
- euc-jp-2007
- EUC-JP
- Extended_UNIX_Code_Packed_Format_for_Japanese
- csEUCPkdFmtJapanese
- X-EUC-JP
- eucjis
- ujis
- windows-950-2000
- Big5
- csBig5
- windows-950
- x-windows-950
- x-big5
- ms950
- ibm-1375_P100-2007
- ibm-1375
- Big5-HKSCS
- big5hk
- HKSCS-BIG5
- windows-936-2000
- GBK
- CP936
- MS936
- windows-936
- ibm-1383_P110-1999
- ibm-1383
- GB2312
- csGB2312
- cp1383
- 1383
- EUC-CN
- ibm-eucCN
- hp15CN
- ibm-1383_VPUA
- ibm-5478_P100-1995
- ibm-5478
- GB_2312-80
- chinese
- iso-ir-58
- csISO58GB231280
- gb2312-1980
- GB2312.1980-0
- ibm-970_P110_P110-2006_U2
- ibm-970
- EUC-KR
- KS_C_5601-1987
- windows-51949
- csEUCKR
- ibm-eucKR
- KSC_5601
- 5601
- cp970
- 970
- ibm-970_VPUA
- x-IBM970
- ibm-1363_P11B-1998
- ibm-1363
- KS_C_5601-1987
- KS_C_5601-1989
- KSC_5601
- csKSC56011987
- korean
- iso-ir-149
- cp1363
- 5601
- ksc
- windows-949
- ibm-1363_VSUB_VPUA
- x-IBM1363C
- windows-949-2000
- windows-949
- KS_C_5601-1987
- KS_C_5601-1989
- KSC_5601
- csKSC56011987
- korean
- iso-ir-149
- ms949
- x-KSC5601
- windows-874-2000
- TIS-620
- windows-874
- MS874
- x-windows-874
- ibm-437_P100-1995
- ibm-437
- IBM437
- cp437
- 437
- csPC8CodePage437
- windows-437
- ibm-775_P100-1996
- ibm-775
- IBM775
- cp775
- csPC775Baltic
- windows-775
- 775
- ibm-850_P100-1995
- ibm-850
- IBM850
- cp850
- 850
- csPC850Multilingual
- windows-850
- ibm-851_P100-1995
- ibm-851
- IBM851
- cp851
- 851
- csPC851
- ibm-852_P100-1995
- ibm-852
- IBM852
- cp852
- 852
- csPCp852
- windows-852
- ibm-855_P100-1995
- ibm-855
- IBM855
- cp855
- 855
- csIBM855
- csPCp855
- windows-855
- ibm-857_P100-1995
- ibm-857
- IBM857
- cp857
- 857
- csIBM857
- windows-857
- ibm-858_P100-1997
- ibm-858
- IBM00858
- CCSID00858
- CP00858
- PC-Multilingual-850+euro
- cp858
- windows-858
- ibm-860_P100-1995
- ibm-860
- IBM860
- cp860
- 860
- csIBM860
- ibm-861_P100-1995
- ibm-861
- IBM861
- cp861
- 861
- cp-is
- csIBM861
- windows-861
- ibm-862_P100-1995
- ibm-862
- IBM862
- cp862
- 862
- csPC862LatinHebrew
- DOS-862
- windows-862
- ibm-863_P100-1995
- ibm-863
- IBM863
- cp863
- 863
- csIBM863
- ibm-864_X110-1999
- ibm-864
- IBM864
- cp864
- csIBM864
- ibm-865_P100-1995
- ibm-865
- IBM865
- cp865
- 865
- csIBM865
- ibm-866_P100-1995
- ibm-866
- IBM866
- cp866
- 866
- csIBM866
- windows-866
- ibm-868_P100-1995
- ibm-868
- IBM868
- CP868
- 868
- csIBM868
- cp-ar
- ibm-869_P100-1995
- ibm-869
- IBM869
- cp869
- 869
- cp-gr
- csIBM869
- windows-869
- ibm-878_P100-1996
- ibm-878
- KOI8-R
- koi8
- csKOI8R
- windows-20866
- cp878
- ibm-1168_P100-2002
- ibm-1168
- KOI8-U
- windows-21866
- ibm-5346_P100-1998
- ibm-5346
- windows-1250
- cp1250
- ibm-5347_P100-1998
- ibm-5347
- windows-1251
- cp1251
- ANSI1251
- ibm-5348_P100-1997
- ibm-5348
- windows-1252
- cp1252
- ibm-5349_P100-1998
- ibm-5349
- windows-1253
- cp1253
- ibm-5350_P100-1998
- ibm-5350
- windows-1254
- cp1254
- ibm-9447_P100-2002
- ibm-9447
- windows-1255
- cp1255
- ibm-9448_X100-2005
- ibm-9448
- windows-1256
- cp1256
- x-windows-1256S
- ibm-9449_P100-2002
- ibm-9449
- windows-1257
- cp1257
- ibm-5354_P100-1998
- ibm-5354
- windows-1258
- cp1258
- macos-0_2-10.2
- macintosh
- mac
- csMacintosh
- windows-10000
- macroman
- x-macroman
- macos-6_2-10.4
- x-mac-greek
- windows-10006
- macgr
- x-MacGreek
- macos-7_3-10.2
- x-mac-cyrillic
- windows-10007
- mac-cyrillic
- maccy
- x-MacCyrillic
- x-MacUkraine
- macos-29-10.2
- x-mac-centraleurroman
- windows-10029
- x-mac-ce
- macce
- maccentraleurope
- x-MacCentralEurope
- macos-35-10.2
- x-mac-turkish
- windows-10081
- mactr
- x-MacTurkish
- ibm-1051_P100-1995
- ibm-1051
- hp-roman8
- roman8
- r8
- csHPRoman8
- x-roman8
- ibm-1276_P100-1995
- ibm-1276
- Adobe-Standard-Encoding
- csAdobeStandardEncoding
- ISO_2022
- locale=ja
- version=0
- ISO-2022-JP
- csISO2022JP
- x-windows-iso2022jp
- x-windows-50220
- ISO_2022
- locale=ja
- version=1
- ISO-2022-JP-1
- JIS_Encoding
- csJISEncoding
- ibm-5054
- JIS
- x-windows-50221
- ISO_2022
- locale=ja
- version=2
- ISO-2022-JP-2
- csISO2022JP2
- ISO_2022
- locale=ko
- version=0
- ISO-2022-KR
- csISO2022KR
- ISO_2022
- locale=zh
- version=0
- ISO-2022-CN
- csISO2022CN
- x-ISO-2022-CN-GB
- ISO_2022
- locale=zh
- version=1
- ISO-2022-CN-EXT
- HZ
- HZ-GB-2312
- ibm-37_P100-1995
- ibm-37
- IBM037
- ibm-037
- ebcdic-cp-us
- ebcdic-cp-ca
- ebcdic-cp-wt
- ebcdic-cp-nl
- csIBM037
- cp037
- 037
- cpibm37
- cp37
- ibm-273_P100-1995
- ibm-273
- IBM273
- CP273
- csIBM273
- ebcdic-de
- 273
- ibm-277_P100-1995
- ibm-277
- IBM277
- cp277
- EBCDIC-CP-DK
- EBCDIC-CP-NO
- csIBM277
- ebcdic-dk
- 277
- ibm-278_P100-1995
- ibm-278
- IBM278
- cp278
- ebcdic-cp-fi
- ebcdic-cp-se
- csIBM278
- ebcdic-sv
- 278
- ibm-280_P100-1995
- ibm-280
- IBM280
- CP280
- ebcdic-cp-it
- csIBM280
- 280
- ibm-284_P100-1995
- ibm-284
- IBM284
- CP284
- ebcdic-cp-es
- csIBM284
- cpibm284
- 284
- ibm-285_P100-1995
- ibm-285
- IBM285
- CP285
- ebcdic-cp-gb
- csIBM285
- cpibm285
- ebcdic-gb
- 285
- ibm-290_P100-1995
- ibm-290
- IBM290
- cp290
- EBCDIC-JP-kana
- csIBM290
- ibm-297_P100-1995
- ibm-297
- IBM297
- cp297
- ebcdic-cp-fr
- csIBM297
- cpibm297
- 297
- ibm-420_X120-1999
- ibm-420
- IBM420
- cp420
- ebcdic-cp-ar1
- csIBM420
- 420
- ibm-424_P100-1995
- ibm-424
- IBM424
- cp424
- ebcdic-cp-he
- csIBM424
- 424
- ibm-500_P100-1995
- ibm-500
- IBM500
- CP500
- ebcdic-cp-be
- csIBM500
- ebcdic-cp-ch
- 500
- ibm-838_P100-1995
- ibm-838
- IBM838
- IBM-Thai
- csIBMThai
- cp838
- 838
- ibm-9030
- ibm-870_P100-1995
- ibm-870
- IBM870
- CP870
- ebcdic-cp-roece
- ebcdic-cp-yu
- csIBM870
- ibm-871_P100-1995
- ibm-871
- IBM871
- ebcdic-cp-is
- csIBM871
- CP871
- ebcdic-is
- 871
- ibm-918_P100-1995
- ibm-918
- IBM918
- CP918
- ebcdic-cp-ar2
- csIBM918
- ibm-1026_P100-1995
- ibm-1026
- IBM1026
- CP1026
- csIBM1026
- 1026
- ibm-1047_P100-1995
- ibm-1047
- IBM1047
- cp1047
- 1047
- ibm-1140_P100-1997
- ibm-1140
- IBM01140
- CCSID01140
- CP01140
- cp1140
- ebcdic-us-37+euro
- ibm-1141_P100-1997
- ibm-1141
- IBM01141
- CCSID01141
- CP01141
- cp1141
- ebcdic-de-273+euro
- ibm-1142_P100-1997
- ibm-1142
- IBM01142
- CCSID01142
- CP01142
- cp1142
- ebcdic-dk-277+euro
- ebcdic-no-277+euro
- ibm-1143_P100-1997
- ibm-1143
- IBM01143
- CCSID01143
- CP01143
- cp1143
- ebcdic-fi-278+euro
- ebcdic-se-278+euro
- ibm-1144_P100-1997
- ibm-1144
- IBM01144
- CCSID01144
- CP01144
- cp1144
- ebcdic-it-280+euro
- ibm-1145_P100-1997
- ibm-1145
- IBM01145
- CCSID01145
- CP01145
- cp1145
- ebcdic-es-284+euro
- ibm-1146_P100-1997
- ibm-1146
- IBM01146
- CCSID01146
- CP01146
- cp1146
- ebcdic-gb-285+euro
- ibm-1147_P100-1997
- ibm-1147
- IBM01147
- CCSID01147
- CP01147
- cp1147
- ebcdic-fr-297+euro
- ibm-1148_P100-1997
- ibm-1148
- IBM01148
- CCSID01148
- CP01148
- cp1148
- ebcdic-international-500+euro
- ibm-1149_P100-1997
- ibm-1149
- IBM01149
- CCSID01149
- CP01149
- cp1149
- ebcdic-is-871+euro
- TSCII
main()
{
string templateFile;
/* An ISO file - fileToString().
Writes the content of the ISO file to a string */
bool ret = fileToString("D:\\Documents\\recodeISO.txt", templateFile, "ISO88591");
DebugN("fileToString() return ", ret);
dyn_string templateConfigs = strsplit(templateFile, '\n');
DebugN("An ISO file to String",templateConfigs);
//ISO file - recode() function.
Converts an ISO file to a UTF8 file
bool ret2 = fileToString("D:\\Documents\\recodeISO.txt", templateFile);
DebugN("fileToString() return ", ret2);
templateFile = recode(templateFile, "ISO88591", "UTF8");
dyn_string templateConfigs = strsplit(templateFile, '\n');
DebugN("An ISO String to UTF",templateConfigs);
}
Assignment
File function
Availability
UI