mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
#4487: have Charset check with codecs for possible aliases.
Previously, unexpected results occurred when email was passed, for example, 'utf8' as a charset name, since email would accept it but would *not* use the 'utf-8' codec for it, even though Python itself recognises that as an alias for utf-8. Now Charset checks with codecs for aliases as well as its own internal table. Issue 8898 has been opened to change this further in py3k so that all aliasing is routed through the codecs module.
This commit is contained in:
parent
eba67c0eac
commit
e7e505ba6e
3 changed files with 13 additions and 1 deletions
|
@ -2868,6 +2868,9 @@ class TestCharset(unittest.TestCase):
|
|||
self.assertEqual(str(charset), 'us-ascii')
|
||||
self.assertRaises(Errors.CharsetError, Charset, 'asc\xffii')
|
||||
|
||||
def test_codecs_aliases_accepted(self):
|
||||
charset = Charset('utf8')
|
||||
self.assertEqual(str(charset), 'utf-8')
|
||||
|
||||
|
||||
# Test multilingual MIME headers.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue