static char hexdig[] = "0123456789abcdef";
#define hextoint( c ) ( isdigit( c ) ? c - '0' : c + 10 - 'a' )
-static char* read_charsets_from_env(charset_t ch)
-{
- char *name;
-
- switch (ch) {
- case CH_MAC:
- if (( name = getenv( "ATALK_MAC_CHARSET" )) != NULL )
- return name;
- else
- return "MAC_ROMAN";
- break;
- case CH_UNIX:
- if (( name = getenv( "ATALK_UNIX_CHARSET" )) != NULL )
- return name;
- else
- return "LOCALE";
- break;
- default:
- break;
- }
- return "ASCII";
-}
-
/**
* Return the name of a charset to give to iconv().
else if (ch == CH_UTF8_MAC) ret = "UTF8-MAC";
else if (ch == CH_UNIX) {
if (unixname[0] == '\0') {
- ret = read_charsets_from_env(CH_UNIX);
+ ret = "LOCALE";
strlcpy(unixname, ret, sizeof(unixname));
}
else
}
else if (ch == CH_MAC) {
if (macname[0] == '\0') {
- ret = read_charsets_from_env(CH_MAC);
+ ret = "MAC_ROMAN";
strlcpy(macname, ret, sizeof(macname));
}
else
if (ln) {
/* Check whether the charset name is supported
by iconv */
+ LOG(log_debug, logtype_default, "Locale charset is '%s'", ln);
atalk_iconv_t handle = atalk_iconv_open(ln, "UCS-2");
if (handle == (atalk_iconv_t) -1) {
- LOG(log_debug, logtype_default, "Locale charset '%s' unsupported, using ASCII instead", ln);
+ LOG(log_warning, logtype_default, "Locale charset '%s' unsupported, using ASCII instead", ln);
ln = "ASCII";
} else {
atalk_iconv_close(handle);
ret = ln;
}
#else /* system doesn't have LOCALE support */
+ LOG(log_warning, logtype_default, "system doesn't have LOCALE support");
if (ch == CH_UNIX) ret = NULL;
#endif