From c8c60c22845177f419e4de7305102310e336b1f0 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 19 Nov 2010 22:09:04 +0000 Subject: [PATCH] Do not put a raw REPLACEMENT CHARACTER in the document. --- Doc/howto/unicode.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst index b809182bb14..77fcd26f75b 100644 --- a/Doc/howto/unicode.rst +++ b/Doc/howto/unicode.rst @@ -263,10 +263,13 @@ Unicode result). The following examples show the differences:: UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0: unexpected code byte >>> b'\x80abc'.decode("utf-8", "replace") - '�abc' + '?abc' >>> b'\x80abc'.decode("utf-8", "ignore") 'abc' +(In this code example, the Unicode replacement character has been replaced by +a question mark because it may not be displayed on some systems.) + Encodings are specified as strings containing the encoding's name. Python 3.2 comes with roughly 100 different encodings; see the Python Library Reference at :ref:`standard-encodings` for a list. Some encodings have multiple names; for