mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Do not insert characters for unicode-escape decoders if the error mode
is "ignore". Fixes #529104.
This commit is contained in:
parent
bdf1f19fee
commit
047c05ebc4
2 changed files with 32 additions and 14 deletions
|
@ -541,6 +541,14 @@ else:
|
|||
verify(unicode('Andr\202 x','ascii','ignore') == u"Andr x")
|
||||
verify(unicode('Andr\202 x','ascii','replace') == u'Andr\uFFFD x')
|
||||
|
||||
verify("\\N{foo}xx".decode("unicode-escape", "ignore") == u"xx")
|
||||
try:
|
||||
"\\".decode("unicode-escape")
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
raise TestFailed, '"\\".decode("unicode-escape") should fail'
|
||||
|
||||
verify(u'hello'.encode('ascii') == 'hello')
|
||||
verify(u'hello'.encode('utf-7') == 'hello')
|
||||
verify(u'hello'.encode('utf-8') == 'hello')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue