Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!fdn.fr!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.046 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'win32': 0.03; 'subject:Python': 0.06; 'subject:bug': 0.07; 'locale': 0.09; 'none)': 0.09; 'subject:2.7': 0.09; 'python': 0.11; '(none,': 0.16; 'inc.)': 0.16; 'subject:)?': 0.16; 'subject:3.3': 0.16; 'tuple': 0.16; 'bit': 0.19; 'module': 0.19; 'have:': 0.19; 'seems': 0.21; '>>>': 0.22; 'import': 0.22; 'skip:l 30': 0.24; 'skip:" 20': 0.27; 'unix': 0.29; 'skip:( 20': 0.30; '"")': 0.31; 'sep': 0.31; 'maybe': 0.34; 'subject: (': 0.35; 'something': 0.35; 'but': 0.35; 'right?': 0.36; 'done': 0.36; 'hi,': 0.36; 'expected': 0.38; 'sometimes': 0.38; 'system,': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'received:67.195': 0.60; 'received:98.137': 0.60; 'more': 0.64; 'header:Reply-To:1': 0.67; 'received:gq1.yahoo.com': 0.68; 'received:mail.gq1.yahoo.com': 0.68; 'results': 0.69; 'apart': 0.72; 'bug!': 0.84; 'more?': 0.84; 'received:bullet.mail.gq1.yahoo.com': 0.84; 'us?': 0.84; '2013,': 0.91; 'medicine,': 0.91; 'education,': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1423496801; bh=92DlmDvJluIw7V/YRJvwMmcxjA5ziMeLZiQyEuHCWm0=; h=Date:From:Reply-To:To:Subject:From:Subject; b=JCdScvUs/RTjOzhnyFoiq90gJ56QPGmETgMTvm8dbnWcH5t3XhGeVpXRhXGUDOqA+oXoDOL3X+QbGuG1q1KE0ddEcA1JIlf9+N88FjSOFpTnqVDkRduMhlLTWFWY/4vkdS3kgT+S1ehdkQ8z6iUbAfl+4t7oroJSngRDrm5BRc+ov7LFIlFC582lnTXehft8selxt1xRkRCkBp/B9PycntiuH6VCMf9jb8wyPQ7buA92UWEXgRiSuMNwCTp/OcOk1x2J2ZoKtaZHdN2+yJ7nmzLldQe/MOJZDj5W4m2ojbMmEQiYZDtA28sHthXcs4eITHkKhJtcxV9urHJLhxszig== X-Yahoo-Newman-Property: ymail-4 X-Yahoo-Newman-Id: 586231.99554.bm@omp1001.mail.gq1.yahoo.com X-YMail-OSG: rA1PYsYVM1l4eYzFALf5IOlsvBgtq8R7kG8Ffs_dUpQPZc1OMTahIAtENGMd1Za EbQoZD80wqHiDNtAg11c8L7hmFrnMkXE2OzRYWAseZFf7kla3VokEvLkaGJoogSE5aQ6KWsq03El CO9fSk5nws9AAkV.iNuYrEYCbKbFWqv.aHBP4tdGtPBPI0ZQpUwSjL_ZdiW1t2QPPafy5ck536WG .cAXJFVySkeANNlH3OWPTP8cBMpGXfess1bdn4n_f3GC1kiP.AVaysiSerqkH94jP98KbaRY161E iT8mFSVPy8yxydm5F8n7tF8eaykfVM6IXs.J6d1hvpzqO7RdTkdAV5gKH2Da2yKO0GcfxGhuXmcO dul1aVkGHYwom4.g2IvjdIdPY.fbiWcsZyQVXmgaA8b4cuS7JKDAalQr5X5oCnsW3zT1lexpyz2C L3e6OpKjltFx6LWDNDQT80Mh8qQ7kTTKb79SkcpkQGnd_7IqhMTVrYnQh_LlJY9WRvDloYq1XcNr iyx.weIoEhZJLlg-- Date: Mon, 9 Feb 2015 15:43:55 +0000 (UTC) From: Albert-Jan Roskam To: Python Subject: locale bug in Python 2.7, 3.3, 3.4 (Win7 64)? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Albert-Jan Roskam 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: 71 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423496994 news.xs4all.nl 2946 [2001:888:2000:d::a6]:45390 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85378 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~