Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.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.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'python.': 0.04; 'advance,': 0.07; 'anyway).': 0.07; 'names.': 0.07; 'system?': 0.07; 'python': 0.08; 'locale': 0.09; 'settings,': 0.09; 'supported,': 0.09; 'configure': 0.10; 'win32': 0.12; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; "'')": 0.16; 'subject:usage': 0.16; 'windows:': 0.16; 'windows?': 0.16; 'language': 0.17; '>>>': 0.18; 'to:2**1': 0.20; 'trying': 0.21; '(but': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'runs': 0.23; 'work,': 0.23; '(or': 0.23; "python's": 0.24; 'skip:l 30': 0.24; 'expect': 0.25; 'windows': 0.26; "i'm": 0.27; 'nov': 0.28; '(this': 0.28; 'right.': 0.28; 'bit': 0.28; 'problem': 0.28; 'import': 0.28; '(and': 0.29; 'skip:( 20': 0.29; 'seem': 0.31; 'changing': 0.31; 'does': 0.32; 'sort': 0.33; 'to:addr:python-list': 0.33; 'header:User-Agent:1': 0.34; 'force': 0.34; 'url:windows': 0.36; 'limitation': 0.37; 'using': 0.37; 'but': 0.37; 'install': 0.37; 'could': 0.38; 'platform': 0.38; 'subject:: ': 0.39; 'received:192': 0.39; 'under': 0.39; 'correctly': 0.39; 'pack': 0.39; 'systems,': 0.39; 'why': 0.39; 'to:addr:python.org': 0.39; 'url:microsoft': 0.40; 'might': 0.40; 'more': 0.60; 'your': 0.61; 'national': 0.63; 'computers': 0.64; 'fan': 0.66; 'proposal': 0.67; 'url:en-us': 0.68; 'wish': 0.69; 'received:62': 0.70; 'care': 0.71; 'instructed': 0.77; '100%': 0.82; '2.7.1': 0.84; 'hungarian': 0.84; 'localized': 0.84; 'received:192.168.0.100': 0.84; 'received:192.168.13': 0.84; 'received:62.179': 0.84; 'received:62.179.121': 0.84; 'received:upcmail.net': 0.84; 'besides,': 0.93 X-SourceIP: 89.132.76.204 Date: Thu, 08 Sep 2011 10:41:22 +0200 From: Laszlo Nagy User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; hu; rv:1.9.2.21) Gecko/20110830 Thunderbird/3.1.13 MIME-Version: 1.0 To: =?UTF-8?B?U2luacWhYSDFoGVndmnEhw==?= , python-list@python.org Subject: Re: Portable locale usage References: <1040759144.28661.1315420437334.JavaMail.root@mail.zemris.fer.hr> In-Reply-To: <1040759144.28661.1315420437334.JavaMail.root@mail.zemris.fer.hr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=h6X7fkn2Y8psEldlT1JduSyVgv7YVLWttKdqKtnr7ik= c=1 sm=0 a=ZIFrzJzj_PwA:10 a=RSPf8KcgRHcA:10 a=IkcTkHD0fZMA:10 a=yMhMjlubAAAA:8 a=7-yP4yQ5llcZMB74iGwA:9 a=yaxB4RSQrnEdW-62a-kA:7 a=QEXdDO2ut3YA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1315471296 news.xs4all.nl 2500 [2001:888:2000:d::a6]:51412 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12950 > I have set the system-wide locale to Croatian (Croatia) > on my development system as instructed by: > http://windows.microsoft.com/en-US/windows-vista/Change-the-system-locale > > Nevertheless, your proposal produces: > ('English_United States','1252') This is what I see on my Hungarian Windows: C:\Users\User>python Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import locale >>> locale.setlocale(locale.LC_ALL, '') 'Hungarian_Hungary.1250' >>> locale.getlocale() ('Hungarian_Hungary', '1250') >>> So I'm 100% sure that the problem is with your system locale settings, not Python. > Note that I would very much like > to avoid changing the system locale > (this requires Administrator password and system restart). All right. But you understand, that Croatian ISO8859-2 is not supported on windows? So you will not be able to sort names with that under a windows system? (And it is not a limitation of Python.) >> Why are you trying to force a specific locale to your program anyway? > Because I wish to be able to correctly sort Croatian names. Well, all right. If you want to sort Croatian names from a program that runs on an English (or whatever) system, then you will have to check the platform and use a locale that is supported by the platform. (But again, this is not Python's limitation. Python doesn't know what encodings are supported, in advance, and you cannot use a locale that is not supported...) > I expect that most of my Windows users will not care > to configure their computers with the national locale > (and besides, that does not seem to work, anyway). Croatian users will most likely use a Croatian Windows, out of the box. And on those systems, using locale.setlocale(locale.LC_ALL, '') will work perfectly. I'm not sure why it doesn't work on an English Windows with locale changed... I'm not a big fan of Windows, but I remember once I had to install a language pack for Windows before I could use a localized program. This might be what you need? Best, Laszlo