[issue19676] Add the "namereplace" error handler

Serhiy Storchaka report at bugs.python.org
Thu Nov 21 08:41:47 CET 2013


New submission from Serhiy Storchaka:

The proposed patch adds the "namereplace" error handler. This error handler is almost same as the "backslashreplace" error handler, but use \N{...} escape sequences if there is a character name in Unicode database. Result is a little more human-readable (but less portable) than with "backslashreplace".

>>> '∀ x∈ℜ'.encode('ascii', 'namereplace')
b'\\N{FOR ALL} x\\N{ELEMENT OF}\\N{BLACK-LETTER CAPITAL R}'

The proposition was discussed and bikeshedded on Python-Ideas: http://comments.gmane.org/gmane.comp.python.ideas/21296 .

----------
components: Unicode
files: namereplace_errors.patch
keywords: patch
messages: 203579
nosy: ezio.melotti, haypo, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add the "namereplace" error handler
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file32748/namereplace_errors.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19676>
_______________________________________


More information about the Python-bugs-list mailing list