Rev 7746 | Rev 7781 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7746 | Rev 7759 | ||
---|---|---|---|
Line 14... | Line 14... | ||
14 | $DD 2 dup 0 |
14 | $DD 2 dup 0 |
Line 15... | Line 15... | ||
15 | 15 | ||
16 | char aIconv_open[] = "iconv_open"; |
16 | char aIconv_open[] = "iconv_open"; |
Line -... | Line 17... | ||
- | 17 | char aIconv[] = "iconv"; |
|
- | 18 | ||
Line 17... | Line 19... | ||
17 | char aIconv[] = "iconv"; |
19 | char charsets[] = "UTF-8\0 KOI8-RU\0 CP1251\0 CP1252\0 ISO8859-5\0CP866"; |
18 | 20 | enum { CH_UTF8, CH_KOI8, CH_CP1251, CH_CP1252, CH_ISO8859_5, CH_CP866, CH_NULL }; |
|
19 | 21 | ||
Line -... | Line 22... | ||
- | 22 | dword ChangeCharset(dword from_chs, to_chs, conv_buf) |
|
- | 23 | { |
|
- | 24 | dword cd, in_len, out_len, new_buf; |
|
20 | dword ChangeCharset(dword from_chs, to_chs, conv_buf) |
25 | |
21 | { |
26 | debug("iconv: from_chs = "); debugln(from_chs); |
22 | dword cd, in_len, out_len, new_buf; |
- | |
23 | 27 | debug("iconv: to_chs = "); debugln(to_chs); |
|
24 | iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5 |
- | |
25 | if (EAX==-1) |
- | |
26 | { |
28 | |
27 | debugln(from_chs); |
29 | iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5 |
28 | debugln(to_chs); |
30 | if (EAX==-1) { |
Line 29... | Line 31... | ||
29 | debugln("iconv: wrong charset,\nuse only CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5"); |
31 | debugln("iconv: unsupported charset"); |
Line 39... | Line 41... | ||
39 | { |
41 | { |
40 | debugval("iconv: something is wrong with stdcall iconv()", cd); |
42 | debugval("iconv: something is wrong with stdcall iconv()", cd); |
41 | debugval("in_len", in_len); |
43 | debugval("in_len", in_len); |
42 | debugval("out_len", out_len); |
44 | debugval("out_len", out_len); |
43 | new_buf = free(new_buf); |
45 | new_buf = free(new_buf); |
44 | return 0; |
46 | return conv_buf; |
45 | } |
47 | } |
46 | strcpy(conv_buf, new_buf); |
48 | strcpy(conv_buf, new_buf); |
47 | free(new_buf); |
49 | free(new_buf); |
48 | return conv_buf; |
50 | return conv_buf; |
49 | } |
51 | } |
Line 50... | Line -... | ||
50 | - | ||
51 | - | ||
52 | :int cur_charset; |
- | |
53 | :char *charsets[] = { "UTF-8", "KOI8-RU", "CP1251", "CP1252", "ISO8859-5", "CP866", 0 }; |
- | |
54 | enum { CH_UTF8, CH_KOI8, CH_CP1251, CH_CP1252, CH_ISO8859_5, CH_CP866, CH_NULL }; |
- | |
55 | 52 | ||
56 | #endif |
53 | #endif |