On Fri, Aug 19, 2016 at 03:22:32PM -0700, Kevin J. McCarthy wrote: > So this is now setting LC_ALL. Is there a reason this wasn't done > before? Are there subtle bugs that may ensue because of this? I have > no idea, so I'd like to hear from everyone familiar with locales issues.
No. Programs that care about locales at all should pretty much always call setlocale(LC_ALL, "") since in the worst case scenario, the user doesn't have any LC_* vars set and they'll just get the default locale ("C") which is what they'd have gotten anyway. In every other case, the call just copies what the user set in their environment. Which is what you want. I suppose the worst case scenario is actually that the user misconfigured those settings, but Mutt would have no way to know that, so it should just always honor what the user asked for. The setlocale(LC_CTYPE...) I removed because it was redundant... the LC_ALL case sets it. It should be fine to move it outside the NLS ifdef too, since, IIUC, with NLS disabled Mutt will just use the English strings in the code, rather than looking them up in the catalog. So again, equivalent to LANG=C, or same effect as not calling setlocale. > > - I ADDED a call to setlocale() before the index is redrawn > > I don't see this change in the patch. Perhaps related to this, how is > the patch dealing with the user setting $locale either in .muttrc or > during execution of mutt? Hmm... I added it to the patched build when I noticed that updates didn't happen without it. I must have forgotten to regenerate the diff after. I probably won't get to fixing that until Monday. Yes, this is (or would have been) what takes care of setting $locale, regardless of how it's set. > > - if (do_locales) > > - setlocale (LC_TIME, "C"); > > + if (!do_locales) > > + setlocale (LC_TIME, Locale); > > It looks like you did this in most places, but make sure to put a NONULL > around Locale here. Yeah. That was another one that's in my patched tree, but didn't make it into the diff. -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02 -=-=-=-=- This message is posted from an invalid address. Replying to it will result in undeliverable mail due to spam prevention. Sorry for the inconvenience.
pgp5_nyar6jlP.pgp
Description: PGP signature