[Alpine-info] nl_langinfo(CODESET) returns unrecognized value
Edgar Fuß
ef at math.uni-bonn.de
Fri Jan 9 03:27:31 PST 2009
Sorry for being unable to correctly link this message to the thread but the list's archive on the web doesn't expose message ids.
After having run into the same problem yesterday, spending a day debugging it not being aware of the fact it's resolved in 2.00 and having it resolved with a wrapper function just like nl_langinfo_codeset_wrapper(), I have three comments on the issue.
First comment (rather irrelevant):
I find it somewhat strange to argue that nl_langinfo(CODESET) returning ,,ISO8859-1'' sans a dash is incorrect. To my knowledge, SUS doesn't specify possible return values, in particular, it doesn't mention MIME character sets. Morover, I wasn't able to find a single Unix-like system returning the dashed version. I tried NetBSD, OS X, Linux, Solaris and AIX.
Second comment (slightly relevant):
> if(output_charset_is_supported(nl_langinfo_codeset_wrapper()))
> ps->GLO_CHAR_SET = cpystr(nl_langinfo_codeset_wrapper());
> else{
> ps->GLO_CHAR_SET = cpystr("UTF-8");
> dprint((1,"nl_langinfo(CODESET) returns unrecognized value=\"%s\", using UTF-8 as default\n", (p=nl_langinfo(CODESET)) ? p : ""));
It looks to me as if that could be optimized to
p = nl_langinfo_codeset_wrapper();
if(output_charset_is_supported(p))
ps->GLO_CHAR_SET = cpystr(p);
else{
ps->GLO_CHAR_SET = cpystr("UTF-8");
dprint((1,"nl_langinfo(CODESET) returns unrecognized value=\"%s\", using UTF-8 as default\n", p ? p : ""));
Third comment (probably relevant):
I first tried to set the display character set in the global config (pine.conf). However, that didn't work. The problem is that in the
ps->GLO_CHAR_SET = cpystr("UTF-8");
statement, ps->GLO_CHAR_SET is the same as vars[V_CHAR_SET] in the
set_current_val(&vars[V_CHAR_SET], TRUE, TRUE);
statement below, so even in the "I don't recognize nl_langinfo(CODESET), so I'll use UTF-8" case, that overwrites what the system administrator put into pine.conf. Is that intended behaviour? I'd argue that the administrator might have put
display-character-set=ISO-8859-1
into pine.conf for a reason, probably because Alpine didn't recognize the locale value.
I'm not sure for the other case (Alpine recognizing the locale result): Should an implicit environment setting override the global configuration?
More information about the Alpine-info
mailing list