Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
edfba824
Commit
edfba824
authored
Aug 15, 2011
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The simplest possible fix for the regression in bug 12752 by encoding unicodes
to 8-bit strings.
parent
5085e8ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
Lib/locale.py
Lib/locale.py
+2
-0
Lib/test/test_locale.py
Lib/test/test_locale.py
+5
-0
No files found.
Lib/locale.py
View file @
edfba824
...
...
@@ -355,6 +355,8 @@ def normalize(localename):
"""
# Normalize the locale name and extract the encoding
if
isinstance
(
localename
,
unicode
):
localename
=
localename
.
encode
(
'ascii'
)
fullname
=
localename
.
translate
(
_ascii_lower_map
)
if
':'
in
fullname
:
# ':' is sometimes used as encoding delimiter.
...
...
Lib/test/test_locale.py
View file @
edfba824
...
...
@@ -412,6 +412,11 @@ class TestMiscellaneous(unittest.TestCase):
locale
.
setlocale
(
locale
.
LC_CTYPE
,
loc
)
self
.
assertEqual
(
loc
,
locale
.
getlocale
())
def
test_normalize_issue12752
(
self
):
# Issue #1813 caused a regression where locale.normalize() would no
# longer accept unicode strings.
self
.
assertEqual
(
locale
.
normalize
(
u'en_US'
),
'en_US.ISO8859-1'
)
def
test_main
():
tests
=
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment