Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using locale does not display the intended behavior #44440

Closed
doko42 opened this issue Jan 11, 2007 · 2 comments
Closed

using locale does not display the intended behavior #44440

doko42 opened this issue Jan 11, 2007 · 2 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@doko42
Copy link
Member

doko42 commented Jan 11, 2007

BPO 1633600
Nosy @doko42, @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-04-04.01:09:59.158>
created_at = <Date 2007-01-11.22:59:32.000>
labels = ['type-bug', 'library']
title = 'using locale does not display the intended behavior'
updated_at = <Date 2009-04-04.01:09:59.020>
user = 'https://github.com/doko42'

bugs.python.org fields:

activity = <Date 2009-04-04.01:09:59.020>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2009-04-04.01:09:59.158>
closer = 'r.david.murray'
components = ['Library (Lib)']
creation = <Date 2007-01-11.22:59:32.000>
creator = 'doko'
dependencies = []
files = []
hgrepos = []
issue_num = 1633600
keywords = []
message_count = 2.0
messages = ['61052', '85360']
nosy_count = 2.0
nosy_names = ['doko', 'r.david.murray']
pr_nums = []
priority = 'normal'
resolution = 'works for me'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue1633600'
versions = ['Python 2.6', 'Python 3.0']

@doko42
Copy link
Member Author

doko42 commented Jan 11, 2007

[forwarded from http://bugs.debian.org/405618]

the locales are available on the system; the string.lowercase constant doesn't change.

bug submitter writes:

Hello, if I interpret correctly http://docs.python.org/lib/node746.html
the characters 'é', 'ç' and so on should be members of
string.lowercase when the locale is set on a french one.

But as you can see here this is not the case:

    % python
    Python 2.4.4 (#2, Oct 20 2006, 00:23:25) 
    [GCC 4.1.2 20061015 (prerelease) (Debian 4.1.1-16.1)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import locale
    >>> locale.setlocale(locale.LC_ALL, '')
    'LC_CTYPE=fr_BE.UTF-8;LC_NUMERIC=fr_BE.UTF-8;LC_TIME=fr_BE.UTF-8;LC_COLLATE=C;LC_MONETARY=fr_BE.UTF-8;LC_MESSAGES=fr_BE.UTF-8;LC_PAPER=fr_BE.UTF-8;LC_NAME=fr_BE.UTF-8;LC_ADDRESS=fr_BE.UTF-8;LC_TELEPHONE=fr_BE.UTF-8;LC_MEASUREMENT=fr_BE.UTF-8;LC_IDENTIFICATION=fr_BE.UTF-8'
    >>> import string
    >>> string.lowercase
    'abcdefghijklmnopqrstuvwxyz'

I also tried to import string before the setlocale call or before the
import locale call but it did not work either.

@doko42 doko42 added the stdlib Python modules in the Lib dir label Jan 11, 2007
@devdanzin devdanzin mannequin added the type-bug An unexpected behavior, bug, or error label Mar 30, 2009
@bitdancer
Copy link
Member

rdmurray@backup:~/trunk>echo $LC_ALL
tr_TR
rdmurray@backup:~/trunk>./python
Python 2.7a0 (unknown, Apr  3 2009, 19:56:38) 
[GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import string
>>> string.lowercase
'abcdefghijklmnopqrstuvwxyz'
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'tr_TR'
>>> string.letters
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\xaa\xb5\xba\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'
>>> string.lowercase
'abcdefghijklmnopqrstuvwxyz\xb5\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'
>>> 

It's possible that the particular python version used in the bug report
had a bug, but if so it is no longer a problem.

Note that these attributes do not exist in the 3.x string module.
For background on this decision see eg:
http://www.mail-archive.com/python-3000@python.org/msg06518.html).

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants