32 static inline unsigned char
41 char *p = malloc (2 * strlen (str) + 1);
45 for (i = 0; str[i]; i++)
47 if (to_uchar (str[i]) < 0x80)
49 else if (to_uchar (str[i]) < 0xC0)
51 p[j++] = (
unsigned char) 0xC2;
56 p[j++] = (
unsigned char) 0xC3;
72 for (i = 0; passwd[i]; i++)
74 if (to_uchar (passwd[i]) > 0x7F)
76 if (to_uchar (passwd[i]) < 0xC0 || to_uchar (passwd[i]) > 0xC3)
77 return strdup (passwd);
79 if (to_uchar (passwd[i]) < 0x80 || to_uchar (passwd[i]) > 0xBF)
80 return strdup (passwd);
84 p = malloc (strlen (passwd) + 1);
88 for (i = 0; passwd[i]; i++)
90 if (to_uchar (passwd[i]) > 0x7F)
94 ((to_uchar (passwd[i]) & 0x3) << 6)
95 | (to_uchar (passwd[i + 1]) & 0x3F);
char * latin1toutf8(const char *str)
char * utf8tolatin1ifpossible(const char *passwd)