Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'subject:Python': 0.06; 'subject:bug': 0.07; 'lawrence': 0.09; 'locale': 0.09; 'none)': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:2.7': 0.09; 'python': 0.11; 'bug': 0.12; 'suggest': 0.14; 'language.': 0.14; '(none,': 0.16; 'inc.)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:)?': 0.16; 'subject:3.3': 0.16; 'tuple': 0.16; 'language': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'module': 0.19; 'have:': 0.19; 'seems': 0.21; 'import': 0.22; 'header:User-Agent:1': 0.23; 'skip:l 30': 0.24; 'tracker': 0.26; 'skip:" 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'unix': 0.29; 'skip:( 20': 0.30; '"")': 0.31; '>>>>': 0.31; 'loads': 0.31; 'sep': 0.31; 'open': 0.33; 'maybe': 0.34; 'subject: (': 0.35; 'problem.': 0.35; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'right?': 0.36; 'done': 0.36; "didn't": 0.36; 'hi,': 0.36; 'reports': 0.37; 'expected': 0.38; 'sometimes': 0.38; 'system,': 0.38; 'to:addr :python-list': 0.38; 'issue': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'our': 0.64; 'more': 0.64; 'charset:windows-1252': 0.65; 'results': 0.69; 'apart': 0.72; 'bug!': 0.84; 'more?': 0.84; 'us?': 0.84; '2013,': 0.91; 'medicine,': 0.91; 'education,': 0.96 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: locale bug in Python 2.7, 3.3, 3.4 (Win7 64)? Date: Mon, 09 Feb 2015 16:02:35 +0000 References: <1130125071.481542.1423496635653.JavaMail.yahoo@mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-92-24-222-48.ppp.as43234.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: <1130125071.481542.1423496635653.JavaMail.yahoo@mail.yahoo.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 85 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423497772 news.xs4all.nl 2920 [2001:888:2000:d::a6]:51201 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85380 On 09/02/2015 15:43, Albert-Jan Roskam wrote: > Hi, > > In the locale module we have: > * setlocale, the setter that also returns something > * getlocale, the getter that returns the OS-specific locale tuple (supposedly!) > > * getdefaultlocale, the getter that always returns a unix locale tuple > > Why are the getlocale() results below sometimes windows-like, sometimes unix-like? > It seems that I need to use setlocale(), with only the 'category' parameter, right? > > > ActivePython 3.3.2.0 (ActiveState Software Inc.) based on > Python 3.3.2 (default, Sep 16 2013, 23:11:39) [MSC v.1600 64 bit (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> import locale >>>> locale.getlocale() > (None, None) # because setocale has not been called yet > > > # works as expected > >>>> locale.setlocale(locale.LC_ALL, "") > 'Dutch_Netherlands.1252' >>>> locale.getlocale() > ('Dutch_Netherlands', '1252') > > # bug!>>> locale.setlocale(locale.LC_ALL, "german") > 'German_Germany.1252' >>>> locale.getlocale() > ('de_DE', 'cp1252') # incorect, unix-like! > > >>>> locale.setlocale(locale.LC_ALL, "German_Germany.1252") > 'German_Germany.1252' >>>> locale.getlocale() > ('de_DE', 'cp1252') # incorect, unix-like! > > > # bug! > >>>> locale.setlocale(locale.LC_ALL, "spanish") > 'Spanish_Spain.1252' >>>> locale.getlocale() > ('es_ES', 'cp1252') # incorect, unix-like! > > > # works as expected >>>> locale.setlocale(locale.LC_ALL, "italian") > 'Italian_Italy.1252' >>>> locale.getlocale() > ('Italian_Italy', '1252') # correct! > > > # ... maybe more? > > > Regards, > > Albert-Jan > There have been loads of bug reports on the issue tracker about locales. I suggest that you take a look to see if there is an open issue about this problem. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a > > fresh water system, and public health, what have the Romans ever done for us? > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Those flaming Romans didn't get the locales right did they? :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence