1 /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
2 See the file COPYING for copying permission.
7 #if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__)))
9 #define WIN32_LEAN_AND_MEAN 1
14 codepageMap(int cp, int *map)
18 if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2)
20 for (i = 0; i < 256; i++)
22 if (info.MaxCharSize > 1) {
23 for (i = 0; i < MAX_LEADBYTES; i+=2) {
25 if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0)
27 lim = info.LeadByte[i + 1];
28 for (j = info.LeadByte[i]; j <= lim; j++)
32 for (i = 0; i < 256; i++) {
36 if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
45 codepageConvert(int cp, const char *p)
48 if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
57 codepageMap(int cp, int *map)
63 codepageConvert(int cp, const char *p)
68 #endif /* not WIN32 */