Subversion Repositories Kolibri OS

Rev

Rev 3107 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3107 Rev 3128
Line 14... Line 14...
14
 
14
 
15
 
15
 
16
dword ChangeCharset(dword from_chs, to_chs, conv_buf)
16
dword ChangeCharset(dword from_chs, to_chs, conv_buf)
17
{
-
 
18
	dword cd, in_len, out_len, new_buf;	
-
 
Line 19... Line 17...
19
	debug (from_chs);
17
{
-
 
18
	dword cd, in_len, out_len, new_buf;	
-
 
19
 
-
 
20
	iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5
-
 
21
	if (EAX==-1)
20
	debug (to_chs);
22
	{
-
 
23
		debug (from_chs);
-
 
24
		debug (to_chs);
21
 
25
		debug("iconv: wrong charset,\nuse only CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5");
Line 22... Line 26...
22
	iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5
26
		return 0; 
23
	if (EAX==-1) { debug("iconv: wrong charset,\nuse only CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5"); return 0; }
27
	}
24
	cd = EAX;
28
	cd = EAX;
25
 
29
 
26
	in_len = out_len = strlen(conv_buf);
30
	in_len = out_len = strlen(conv_buf)+1;
27
	new_buf = mem_Alloc(in_len);
31
	new_buf = mem_Alloc(in_len);
Line 34... Line 38...
34
		debug("in_len");
38
		debug("in_len");
35
		debug(itoa(in_len));
39
		debug(itoa(in_len));
36
		debug("out_len");
40
		debug("out_len");
37
		debug(itoa(out_len));
41
		debug(itoa(out_len));
38
		new_buf = 0;
42
		new_buf = 0;
-
 
43
		return 0;
39
	}
44
	}
-
 
45
	strcpy(conv_buf, new_buf);
-
 
46
	free(new_buf);
40
	return new_buf;
47
	return conv_buf;
41
}
48
}
42
49