You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2007-03-05.17:54:51.000>created_at=<Date2007-03-05.17:11:09.000>labels= ['invalid']
title='Unicode xmlcharrefreplace produces backslash not xml style.'updated_at=<Date2007-03-05.17:54:51.000>user='https://bugs.python.org/odontomatix'
Example at Python shell:
u'\u2122'.encode('unicode_escape','xmlcharrefreplace')
should produce: ™
but it produces \u2122
The same happens when it is used in a program. The print output of the encoded unicode contains backslash encodings as though the method 'backslashreplace' had been used.
u'\u2122'.encode('unicode_escape','xmlcharrefreplace') produces \u2122 because that's the way the unicode_escape codec outputs unicode codepoints. For unicode_escape the xmlcharrefreplace error handler never kicks in. If you want the error handler to kick in, you have to use an encoding that doesn't support the character you want to encode. The best candidate is probably ascii:
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: