Stringtools support those code pages?

Chinese = "中国"
a = "test" & Chinese

CodePageI = array(37, 437, 500, 708, 720, 737, 775, 850, 852, 855, 857, 858, 860, 861, 862, 863, 864, 865, 866, 869, 870, 874, 875, 932, 936, 949, 950, 1026, 1047, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1200, 1201, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1361, 10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10010, 10017, 10021, 10029, 10079, 10081, 10082, 12000, 12001, 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, 21866, 28591, 28592, 28593, 28594, 28595, 28596, 28597, 28598, 28599, 28603, 28605, 29001, 38598, 50220, 50221, 50222, 50225, 50227, 51932, 51936, 51949, 52936, 54936, 57002, 57003, 57004, 57005, 57006, 57007, 57008, 57009, 57010, 57011, 65000, 65001)
CodePageS = array("37", "437", "500", "708", "720", "737", "775", "850", "852", "855", "857", "858", "860", "861", "862", "863", "864", "865", "866", "869", "870", "874", "875", "932", "936", "949", "950", "1026", "1047", "1140", "1141", "1142", "1143", "1144", "1145", "1146", "1147", "1148", "1149", "1200", "1201", "1250", "1251", "1252", "1253", "1254", "1255", "1256", "1257", "1258", "1361", "10000", "10001", "10002", "10003", "10004", "10005", "10006", "10007", "10008", "10010", "10017", "10021", "10029", "10079", "10081", "10082", "12000", "12001", "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", "21866", "28591", "28592", "28593", "28594", "28595", "28596", "28597", "28598", "28599", "28603", "28605", "29001", "38598", "50220", "50221", "50222", "50225", "50227", "51932", "51936", "51949", "52936", "54936", "57002", "57003", "57004", "57005", "57006", "57007", "57008", "57009", "57010", "57011", "65000", "65001")
CodePageName = array("IBM037", "IBM437", "IBM500", "ASMO-708", "DOS-720", "ibm737", "ibm775", "ibm850", "ibm852", "IBM855", "ibm857", "IBM00858", "IBM860", "ibm861", "DOS-862", "IBM863", "IBM864", "IBM865", "cp866", "ibm869", "IBM870", "windows-874", "cp875", "shift_jis", "gb2312", "ks_c_5601-1987", "big5", "IBM1026", "IBM01047", "IBM01140", "IBM01141", "IBM01142", "IBM01143", "IBM01144", "IBM01145", "IBM01146", "IBM01147", "IBM01148", "IBM01149", "utf-16", "unicodeFFFE", "windows-1250", "windows-1251", "Windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258", "Johab", "macintosh", "x-mac-japanese", "x-mac-chinesetrad", "x-mac-korean", "x-mac-arabic", "x-mac-hebrew", "x-mac-greek", "x-mac-cyrillic", "x-mac-chinesesimp", "x-mac-romanian", "x-mac-ukrainian", "x-mac-thai", "x-mac-ce", "x-mac-icelandic", "x-mac-turkish", "x-mac-croatian", "utf-32", "utf-32BE", "x-Chinese-CNS", "x-cp20001", "x-Chinese-Eten", "x-cp20003", "x-cp20004", "x-cp20005", "x-IA5", "x-IA5-German", "x-IA5-Swedish", "x-IA5-Norwegian", "us-ascii", "x-cp20261", "x-cp20269", "IBM273", "IBM277", "IBM278", "IBM280", "IBM284", "IBM285", "IBM290", "IBM297", "IBM420", "IBM423", "IBM424", "x-EBCDIC-KoreanExtended", "IBM-Thai", "koi8-r", "IBM871", "IBM880", "IBM905", "IBM00924", "EUC-JP", "x-cp20936", "x-cp20949", "cp1025", "koi8-u", "iso-8859-1", "iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8", "iso-8859-9", "iso-8859-13", "iso-8859-15", "x-Europa", "iso-8859-8-i", "iso-2022-jp", "csISO2022JP", "iso-2022-jp", "iso-2022-kr", "x-cp50227", "euc-jp", "EUC-CN", "euc-kr", "hz-gb-2312", "GB18030", "x-iscii-de", "x-iscii-be", "x-iscii-ta", "x-iscii-te", "x-iscii-as", "x-iscii-or", "x-iscii-ka", "x-iscii-ma", "x-iscii-gu", "x-iscii-pa", "utf-7", "utf-8")

dim st,blTest
On Error Resume Next
set st = dopus.create.stringtools
for i = 0 to UBound(CodePageI)
	set blTest = st.encode(a, CodePageI(i))
	if err.number = 0 then 
		dopus.output "Integer" & chr(9) & "OK" & chr(9) & CodePageI(i) & chr(9) & "CodePage ID = " & CodePageI(i) & chr(9) & "Error Number: " & err.number
	else
		dopus.output "Integer" & chr(9) & "NO" & chr(9) & CodePageI(i) & chr(9) & "CodePage ID = " & CodePageI(i) & chr(9) & "Error Number: " & err.number
	end if
	err.clear
next

for i = 0 to UBound(CodePageS)
	set blTest = st.encode(a, CodePageS(i))
	if err.number = 0 then 
		dopus.output "String" & chr(9) & "OK" & chr(9) & CodePageS(i) & chr(9) & "CodePage ID = " & CodePageS(i) & chr(9) & "Error Number: " & err.number
	else
		dopus.output "String" & chr(9) & "NO" & chr(9) & CodePageS(i) & chr(9) & "CodePage ID = " & CodePageS(i) & chr(9) & "Error Number: " & err.number
	end if
	err.clear
next

for i = 0 to UBound(CodePageName)
	set blTest = st.encode(a, CodePageName(i))
	if err.number = 0 then 
		dopus.output "CodePageName" & chr(9) & "OK" & chr(9) & CodePageName(i) & chr(9) & "CodePage ID = " & CodePageName(i) & chr(9) & "Error Number: " & err.number
	else
		dopus.output "CodePageName" & chr(9) & "NO" & chr(9) & CodePageName(i) & chr(9) & "CodePage ID = " & CodePageName(i) & chr(9) & "Error Number: " & err.number
	end if
	err.clear
next

My test results. The following code page names are supported:

ASMO-708
DOS-720
ibm852
DOS-862
cp866
windows-874
gb2312
big5
windows-1258
koi8-r
iso-8859-1
iso-8859-2
iso-8859-3
iso-8859-4
iso-8859-5
iso-8859-6
iso-8859-7
iso-8859-8
iso-8859-9
iso-8859-8-i
iso-2022-jp
iso-2022-jp
iso-2022-kr
euc-kr
hz-gb-2312
utf-7
utf-8


Otherwise, format must be set to a valid code-page name (e.g. "utf-8" , "gb2312" etc.), or a Windows code-page ID (e.g. 936 , 65001 ). The source will be decoded using the specified code-page and a string is returned.

The manual explains that using a code page ID is an error (numeric or string) and can only use the code page name.

Using a numeric IDs for codepages is fine, as long as it's one Windows supports and one which can encode the input data (else the call may fail, at least in 12.9.2; the results were undefined in earlier versions).

Installed codepages can be found listed by numeric ID in your registry under HKEY_CLASSES_ROOT\MIME\Database\Codepage, and each codepage has a BodyCharset value below it with its name.

For example, 1251 is the koi8-r codepage, and using either that number or that name should work:

My test results.

Can you write an example?

Can all of the characters in the multi-language string you are passing in be encoded in the koi8-r codepage?

Try using "utf-8" as the code page, which should always work. If that doesn't work there may be a mistake in the code, but the code looks OK to me so I think the problem is the string cannot be represented in the codepage you're choosing.

If it works with "utf-8" as the codepage, but not another, try using a simple string that only uses characters from the codepage's language.