2 * Unicode string management
4 * Copyright 1996 Martin von Loewis
6 * Conversion between Unicode and ISO-8859-1 is inherently lossy,
7 * so the conversion code should be called only if it does not matter
18 void STRING32_UniToAnsi(LPSTR dest
,LPCWSTR src
)
20 static int have_warned
=0;
23 if(*src
>255 && !have_warned
)
25 fprintf(stderr
,"Cannot deal with non-ANSI characters\n");
30 /* copy the terminator */
34 /* FIXME: we need to use unsigned char here, for if
35 * we got chars with the 7th bit set, we will get
36 * negative integers -> wrong unicode values
39 STRING32_AnsiToUni(LPWSTR dest
,LPCSTR src
) {
42 usrc
=(unsigned char*)src
;
48 LPSTR
STRING32_DupUniToAnsi(LPCWSTR src
)
50 LPSTR dest
=xmalloc(lstrlen32W(src
)+1);
51 STRING32_UniToAnsi(dest
,src
);
55 LPWSTR
STRING32_DupAnsiToUni(LPCSTR src
)
57 LPWSTR dest
=xmalloc(2*strlen(src
)+2);
58 STRING32_AnsiToUni(dest
,src
);
62 /* not an API function */
64 WCHAR
STRING32_tolowerW(WCHAR c
)
71 STRING32_lstrchrW(LPCWSTR a
,WCHAR c
) {
81 STRING32_strdupW(LPCWSTR a
) {
85 len
=sizeof(WCHAR
)*(lstrlen32W(a
)+1);
86 b
=(LPWSTR
)xmalloc(len
);