Rev 3106 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3107 | leency | 1 | //convert text characters |
3106 | leency | 2 | |
3 | dword iconv_lib = #a_iconv_lib; |
||
4 | char a_iconv_lib[19]="/sys/lib/iconv.obj\0"; |
||
5 | |||
6 | dword iconv_open = #aIconv_open; |
||
7 | dword iconv = #aIconv; |
||
8 | |||
9 | dword am5__ = 0x0; |
||
10 | dword bm5__ = 0x0; |
||
11 | |||
12 | char aIconv_open[11] = "iconv_open\0"; |
||
13 | char aIconv[6] = "iconv\0"; |
||
14 | |||
15 | |||
16 | dword ChangeCharset(dword from_chs, to_chs, conv_buf) |
||
17 | { |
||
18 | dword cd, in_len, out_len, new_buf; |
||
19 | debug (from_chs); |
||
20 | debug (to_chs); |
||
21 | |||
22 | iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5 |
||
23 | if (EAX==-1) { debug("iconv: wrong charset,\nuse only CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5"); return 0; } |
||
24 | cd = EAX; |
||
25 | |||
26 | in_len = out_len = strlen(conv_buf); |
||
27 | new_buf = mem_Alloc(in_len); |
||
28 | iconv stdcall (cd, #conv_buf, #in_len, #new_buf, #out_len); |
||
29 | cd = EAX; |
||
30 | if (cd!=0) |
||
31 | { |
||
3107 | leency | 32 | debug("iconv: something is wrong with stdcall iconv()"); |
3106 | leency | 33 | debug(itoa(cd)); |
34 | debug("in_len"); |
||
35 | debug(itoa(in_len)); |
||
36 | debug("out_len"); |
||
37 | debug(itoa(out_len)); |
||
38 | new_buf = 0; |
||
39 | } |
||
40 | return new_buf; |
||
41 | } |