-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
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
Show resolved
Hide resolved
|
||
| out = encodings.normalize_encoding('utf 8') | ||
| self.assertEqual(out, 'utf_8') | ||
shihai1991 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| out = encodings.normalize_encoding('UTF 8') | ||
|
||
| self.assertEqual(out, 'UTF_8') | ||
| out = encodings.normalize_encoding('utf...8') | ||
shihai1991 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| self.assertEqual(out, 'utf...8') | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.