Re: Portable locale usage

2011-09-12 Thread Siniša Šegvić
> From: "Laszlo Nagy" > To: "Siniša Šegvić" , python-list@python.org > Sent: Friday, September 9, 2011 11:39:52 AM > Subject: Re: Portable locale usage > > Looks like you have found a bug! :-) Why don't you post a bug report? I just did: http://bugs

Re: Portable locale usage

2011-09-09 Thread Laszlo Nagy
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

Re: Portable locale usage

2011-09-08 Thread Siniša Šegvić
> From: "Laszlo Nagy" > To: "Siniša Šegvić" , python-list@python.org > Sent: Thursday, September 8, 2011 10:41:22 AM > Subject: Re: Portable locale usage > > I have set the system-wide locale to Croatian (Croatia) > > on my development system as instru

Re: Portable locale usage

2011-09-08 Thread Laszlo Nagy
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:\U

Re: Portable locale usage

2011-09-07 Thread Thomas Jollans
On 07/09/11 20:33, Siniša Šegvić wrote: > 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). Are, on Windows, the default system region/language setting, and the locale, distinct? (And,

Re: Portable locale usage

2011-09-07 Thread Siniša Šegvić
> From: "Laszlo Nagy" > To: "ssegvic" , python-list@python.org > Sent: Wednesday, September 7, 2011 4:51:20 PM > Subject: Re: Portable locale usage > > 1. Is there a way for writing portable Python code dealing with > > locales (as sketched in the begi

Re: Portable locale usage

2011-09-07 Thread Laszlo Nagy
1. Is there a way for writing portable Python code dealing with locales (as sketched in the beginning)? I usually do this at the top of my main program, before importing other modules: import locale locale.setlocale(locale.LC_ALL, '') This is absolutely portable. The above snippet work

Re: Portable locale usage

2011-09-07 Thread Thomas Jollans
On 07/09/11 12:39, ssegvic wrote: > On 6 ruj, 17:53, Thomas Jollans wrote: >> On 06/09/11 16:46, ssegvic wrote: >> >>> For the moment, I only wish to properly sort a Croatian text file >>> both on Windows and Linux (I am a cautious guy, I like reachable >>> goals). >>> When the locale is properly

Re: Portable locale usage

2011-09-07 Thread ssegvic
On 6 ruj, 17:53, Thomas Jollans wrote: > On 06/09/11 16:46, ssegvic wrote: > > > For the moment, I only wish to properly sort a Croatian text file > > both on Windows and Linux (I am a cautious guy, I like reachable > > goals). > > When the locale is properly set, sorting works like a charm > > wi

Re: Portable locale usage

2011-09-07 Thread ssegvic
On 6 ruj, 17:53, Thomas Jollans wrote: > On 06/09/11 16:46, ssegvic wrote: > > > For the moment, I only wish to properly sort a Croatian text file > > both on Windows and Linux (I am a cautious guy, I like reachable > > goals). > > When the locale is properly set, sorting works like a charm > > wi

Re: Portable locale usage

2011-09-07 Thread ssegvic
On 6 ruj, 22:58, garabik-news-2005...@kassiopeia.juls.savba.sk wrote: > Thomas Jollans wrote: > > It looks like you don't actually care about the encoding: in your first > > example, you use the default system encoding, which you do not control, > > and in your second example, you're using two dif

Re: Portable locale usage

2011-09-06 Thread garabik-news-2005-05
Thomas Jollans wrote: > It looks like you don't actually care about the encoding: in your first > example, you use the default system encoding, which you do not control, > and in your second example, you're using two different encodings on the > two platforms. So why do you care whether or not t

Re: Portable locale usage

2011-09-06 Thread Thomas Jollans
On 06/09/11 16:46, ssegvic wrote: > For the moment, I only wish to properly sort a Croatian text file > both on Windows and Linux (I am a cautious guy, I like reachable > goals). > When the locale is properly set, sorting works like a charm > with mylist.sort(key=locale.strxfrm). The problem with

Re: Portable locale usage

2011-09-06 Thread ssegvic
On 6 ruj, 15:13, Vlastimil Brom wrote: > There may be some differences btween OSes end the versions, but using > python 2.7 and 3.2 on Win XP and Win7 (Czech) > I get the following results for setlocale: > > >>> locale.setlocale(locale.LC_ALL,'Croatian') > > 'Croatian_Croatia.1250'>>> locale.getl

Re: Portable locale usage

2011-09-06 Thread ssegvic
On 6 ruj, 13:16, Thomas Jollans wrote: > > locale.setlocale(locale.LC_ALL, (myISOCountryCode, > > locale.getpreferredencoding())) > > As far as I can tell, this does work. Can you show us a traceback? Sorry, I was imprecise. I wanted to say that the above snippet does not work both on Windows an

Re: Portable locale usage

2011-09-06 Thread Vlastimil Brom
2011/9/6 ssegvic : > Hi, > > I am musing on how to write portable Python3 code which would > take advantage of the standard locale module. > > For instance, it would be very nice if we could say something like: > > # does not work! > myISOCountryCode='hr' > locale.setlocale(locale.LC_ALL, (myISOCou

Re: Portable locale usage

2011-09-06 Thread Thomas Jollans
On 06/09/11 11:59, ssegvic wrote: > Hi, > > I am musing on how to write portable Python3 code which would > take advantage of the standard locale module. > > For instance, it would be very nice if we could say something like: > > # does not work! Doesn't it? > myISOCountryCode='hr' This is a l

Portable locale usage

2011-09-06 Thread ssegvic
Hi, I am musing on how to write portable Python3 code which would take advantage of the standard locale module. For instance, it would be very nice if we could say something like: # does not work! myISOCountryCode='hr' locale.setlocale(locale.LC_ALL, (myISOCountryCode, locale.getpreferredencodin