Why can the default locale not be set by its true name? but only by '' ? :
PythonWin 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32.
>>import locale locale.getloc ale()
(None, None)
>>locale.setloc ale(locale.LC_A LL,"de_DE")
Traceback (most recent call last):
File "<interacti ve input>", line 1, in <module>
File "C:\Python25\li b\locale.py", line 476, in setlocale
return _setlocale(cate gory, locale)
Error: unsupported locale setting
>>locale.getdef aultlocale()
('de_DE', 'cp1252')
>>locale.setloc ale(locale.LC_A LL,locale.getde faultlocale())
Traceback (most recent call last):
File "<interacti ve input>", line 1, in <module>
File "C:\Python25\li b\locale.py", line 476, in setlocale
return _setlocale(cate gory, locale)
Error: unsupported locale setting
>>locale.setloc ale(locale.LC_A LL)
'C'
>>locale.setloc ale(locale.LC_A LL,'')
'German_Germany .1252'
>>locale.getloc ale()
('de_DE', 'cp1252')
>>>
3 7203
robert wrote:
Why can the default locale not be set by its true name? but only by '' ? :
Probably it is just not implemented. But since locale names are system
specific (For example windows accepts 'ch' as Chinese in Taiwan, where
as IANA <http://www.iana.org/assignments/language-subtag-registry>
considers it Chamorro) setlocale should probably grow an additional
keyword parameter: setlocale(LC_AL L, iana='de-DE')
-- Leo
Leo Kislov wrote:
robert wrote:
>Why can the default locale not be set by its true name? but only by '' ? :
Probably it is just not implemented. But since locale names are system
specific (For example windows accepts 'ch' as Chinese in Taiwan, where
as IANA <http://www.iana.org/assignments/language-subtag-registry>
considers it Chamorro) setlocale should probably grow an additional
keyword parameter: setlocale(LC_AL L, iana='de-DE')
that'd be another fat database to blow up the python core(s).
I just wonder why locale.setlocal e(locale.LC_ALL ,"de_DE") doesn't accept the name, which
>>locale.getloc ale() / getdefaultlocal e()
('de_DE', 'cp1252')
already deliver ?
but only this works
>>locale.setloc ale(locale.LC_A LL,'German_Germ any.1252')
'German_Germany .1252'
But 'German_Germany .1252' you cannot get/guess from any locale.getxxxx function I think ...
-robert
robert wrote:
Leo Kislov wrote:
robert wrote:
Why can the default locale not be set by its true name? but only by '' ? :
Probably it is just not implemented. But since locale names are system
specific (For example windows accepts 'ch' as Chinese in Taiwan, where
as IANA <http://www.iana.org/assignments/language-subtag-registry>
considers it Chamorro) setlocale should probably grow an additional
keyword parameter: setlocale(LC_AL L, iana='de-DE')
that'd be another fat database to blow up the python core(s).
I just wonder why locale.setlocal e(locale.LC_ALL ,"de_DE") doesn't accept the name, which
>locale.getloca le() / getdefaultlocal e()
('de_DE', 'cp1252')
already deliver ?
It is documented that those functions return cross platform RFC 1766
language code. This code sometimes won't be compatible with OS specific
locale name. Cross platform code can useful if you want to create your
own locale database for example cross platform language packs.
Right now we have:
setlocale(categ ory) -- get(it's not a typo) OS locale name
getlocale(categ ory) -- get cross platform locale name
setlocale(categ ory,'') -- enable default locale, return OS locale name
getdefaultlocal e() -- get cross platform locale name
I agree it's very confusing API, especially setlocale acting like
getter, but that's what we have. Improvement is welcome.
-- Leo This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: aa |
last post by:
Warning: mail(): Failed to connect to mailserver at "localhost" port 25,
verify your "SMTP" and "smtp_port" setting in php.ini
in php.ini I have:
SMTP = localhost
SMTP_PORT = 25
SENDMAIL_FROM = NULL
SENDMAIL_PATH = "H:\WINNT\system32\" (this is where sendmail.dll is
sitting. H is the drive with w2k)
|
by: Dayne |
last post by:
I know I can get the user's last input info with the win32 function
"GetLastInputInfo", but how do I set this value without any physical input
from the user? Any idea?
DT
|
by: AA Arens |
last post by:
When I place a record serch utility (vos the button placement wizzrd),
I discovered that the Match setting is "Whole Field" by default. How to
make "Any Part Of Field" default?
|
by: Torsten Sturm |
last post by:
Hello,
SP1 of Windows Server introduced a new "feature" in the GlobalizationConfig
class
called EnableBestFitResponseEncoding.
Effect is that when you set anything other than UTF8 in web.config, e.g.
<globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" />,
many functions will break (including HttpUtility.URLDecode) with a
MethodNotImplementedExecption in the new internal class
|
by: gabon |
last post by:
I'm creating a select entirely through JavaScript and very strangely IE
doesn't show the text in the option elements.
Here part of the code:
this.form_country=document.createElement("select");
var option;
for(var i=0; i<arr.length; i++){
option=document.createElement("option");
option.value=arr.code;
| |
by: Ken Schutte |
last post by:
Lets say I want an integer class that lets you attach arbitrary
attributes. I can simply do:
class foo(int): pass
x = foo(5)
x.text = "okay"
print x, x.text # prints "5 okay"
So, that's good. But, how can I change the value of x from 5 to
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
by: Kerem Gümrükcü |
last post by:
Hi All,
i am too tired now to find this out by my own, but why does
my while loop "while(readline==Console.ReadLine())" needs
twice return hit to read the line, after setting
"Console.TreatControlCAsInput = true". How can i make it
work like it would be set to "false", so that i only must hit the
return once to get the input,...
TIA
|
by: Kirk Wolf |
last post by:
The IT folks did an automatic upgrade of DB2 connect to V9 our our
Windows machines, and now when we try to use DB2 on z/OS from an
Eclipse plugin called "SqlExplorer", we get the following JDBC
SqlException:
com.ibm.db2.jcc.b.SqlException:
Unsupported ccsid, encoding, or locale: "Cp037"
Does anyone know what component is unable to use Cp037?
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |