[Python-checkins] cpython (merge 2.7 -> 2.7): Automated merge with file:///home/vagrant/3.2

senthil.kumaran python-checkins at python.org
Wed Sep 12 07:17:53 CEST 2012


http://hg.python.org/cpython/rev/befd752a3218
changeset: 79003:befd752a3218
branch: 2.7
parent: 78999:739606bdcba4
parent: 79002:142fbadd0ae1
user: Senthil Kumaran <senthil at uthcode.com>
date: Tue Sep 11 22:16:58 2012 -0700
summary:
 Automated merge with file:///home/vagrant/3.2
files:
 Doc/howto/unicode.rst | 32 ++++++++++++++++--------------
 1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst
--- a/Doc/howto/unicode.rst
+++ b/Doc/howto/unicode.rst
@@ -253,11 +253,11 @@
 >>> s = unicode('abcdef')
 >>> type(s)
 <type 'unicode'>
- >>> unicode('abcdef' + chr(255))
+ >>> unicode('abcdef' + chr(255)) #doctest: +NORMALIZE_WHITESPACE
 Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ ...
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 6:
- ordinal not in range(128)
+ ordinal not in range(128)
 
 The ``errors`` argument specifies the response when the input string can't be
 converted according to the encoding's rules. Legal values for this argument are
@@ -265,11 +265,11 @@
 'REPLACEMENT CHARACTER'), or 'ignore' (just leave the character out of the
 Unicode result). The following examples show the differences::
 
- >>> unicode('\x80abc', errors='strict')
+ >>> unicode('\x80abc', errors='strict') #doctest: +NORMALIZE_WHITESPACE
 Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ ...
 UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0:
- ordinal not in range(128)
+ ordinal not in range(128)
 >>> unicode('\x80abc', errors='replace')
 u'\ufffdabc'
 >>> unicode('\x80abc', errors='ignore')
@@ -312,10 +312,11 @@
 operation; Python's default ASCII encoding will be used, so characters greater
 than 127 will cause an exception::
 
- >>> s.find('Was\x9f')
+ >>> s.find('Was\x9f') #doctest: +NORMALIZE_WHITESPACE
 Traceback (most recent call last):
- File "<stdin>", line 1, in ?
- UnicodeDecodeError: 'ascii' codec can't decode byte 0x9f in position 3: ordinal not in range(128)
+ ...
+ UnicodeDecodeError: 'ascii' codec can't decode byte 0x9f in position 3:
+ ordinal not in range(128)
 >>> s.find(u'Was\x9f')
 -1
 
@@ -333,10 +334,11 @@
 >>> u = unichr(40960) + u'abcd' + unichr(1972)
 >>> u.encode('utf-8')
 '\xea\x80\x80abcd\xde\xb4'
- >>> u.encode('ascii')
+ >>> u.encode('ascii') #doctest: +NORMALIZE_WHITESPACE
 Traceback (most recent call last):
- File "<stdin>", line 1, in ?
- UnicodeEncodeError: 'ascii' codec can't encode character '\ua000' in position 0: ordinal not in range(128)
+ ...
+ UnicodeEncodeError: 'ascii' codec can't encode character u'\ua000' in
+ position 0: ordinal not in range(128)
 >>> u.encode('ascii', 'ignore')
 'abcd'
 >>> u.encode('ascii', 'replace')
@@ -384,9 +386,9 @@
 ::
 
 >>> s = u"a\xac\u1234\u20ac\U00008000"
- ^^^^ two-digit hex escape
- ^^^^^^ four-digit Unicode escape
- ^^^^^^^^^^ eight-digit Unicode escape
+ ... # ^^^^ two-digit hex escape
+ ... # ^^^^^^ four-digit Unicode escape
+ ... # ^^^^^^^^^^ eight-digit Unicode escape
 >>> for c in s: print ord(c),
 ...
 97 172 4660 8364 32768
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /