-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
bpo-39337: encodings.normalize_encoding() now ignores non-ASCII characters #22219
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
Changes from 1 commit
8ae6408
0fcafb8
dea24d8
dbb0062
3fa221f
a69eef8
2e73d13
95c1d98
03bfd9b
38f28bd
5982784
4ecb8a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3442,19 +3442,18 @@ def search_function(encoding): | |
|
|
||
| class EncodingNormalizationTest(unittest.TestCase): | ||
|
|
||
| def test_bpo39337(self): | ||
| """ | ||
| bpo-39337: similar to _Py_normalize_encoding(), | ||
| encodings.normalize_encoding() should ignore non-ASCII letters. | ||
| """ | ||
| import encodings | ||
|
|
||
| def test_normalization(self): | ||
| # encodings.normalize_encoding() ignores non-ASCII letters. | ||
| out = encodings.normalize_encoding('utf\xE9\u20AC\U0010ffff-8') | ||
| self.assertEqual(out, 'utf_8') | ||
| out = encodings.normalize_encoding('utf_8') | ||
| self.assertEqual(out, 'utf_8') | ||
|
shihai1991 marked this conversation as resolved.
Outdated
|
||
| out = encodings.normalize_encoding('utf 8') | ||
| self.assertEqual(out, 'utf_8') | ||
|
shihai1991 marked this conversation as resolved.
Outdated
|
||
| out = encodings.normalize_encoding('UTF 8') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind to add a comment to explain that the function does not convert upper case letters to lower case letters, just to make the purpose of this test even more explicit?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be honest, I don't know how to exact explain it~
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just describe the fact, Lol~
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can |
||
| self.assertEqual(out, 'UTF_8') | ||
| out = encodings.normalize_encoding('utf...8') | ||
|
shihai1991 marked this conversation as resolved.
Outdated
|
||
| self.assertEqual(out, 'utf...8') | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.