Recipients eryksun,, r.david.murray
Date 2015-02-17.10:35:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>

Thanks for your replies. Eryksun (nice to meet you here too!), your function seems very useful, thank you very much. I had indeed already switched to your 'getrawlocale' approach.

Perhaps off-topic (because I have never seen this happen in Windows), but locale.getlocale() sometimes returns (None, None), *even if* locale.setlocale(locale.LC_ALL, "") has been called at the start of the program. For some reason, LANG, LC_ALL and possible other vars are sometimes not set correctly (I know this is not Python's fault, but...). Would it be a good idea to have a 'failsafe' parameter in getlocale? Something like:

def safe_getlocale(failsafe=False):
    current_locale = locale.getlocale()
    if failsafe and current_locale[0] is None and not sys.platform.startswith("win"):
        os.environ["LANG"] = "en_US.UTF-8"
        os.environ["LC_ALL"] = "en_US.UTF-8"
        current_locale = locale.getlocale()
     return current_locale

(sorry for squeezing this in the current issue!)

Date User Action Args
2015-02-17 10:35:52fomcl@yahoo.comsetrecipients: +, r.david.murray, eryksun
2015-02-17 10:35:52fomcl@yahoo.comsetmessageid: <>
2015-02-17 10:35:52fomcl@yahoo.comlinkissue23425 messages
2015-02-17 10:35:52fomcl@yahoo.comcreate