summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorKa-Ping Yee <ping@zesty.ca>2001-01-24 17:19:08 (GMT)
committerKa-Ping Yee <ping@zesty.ca>2001-01-24 17:19:08 (GMT)
commitfa004ad36c86f4af406cfa3a84ec8b6cb391e6dd (patch)
tree61544d6bc2f118d4187cfc4887711f728d0fb7cf /Doc
parent726b78ecb8660278399abaf36f98dec56ecf1271 (diff)
downloadcpython-fa004ad36c86f4af406cfa3a84ec8b6cb391e6dd.zip
cpython-fa004ad36c86f4af406cfa3a84ec8b6cb391e6dd.tar.gz
cpython-fa004ad36c86f4af406cfa3a84ec8b6cb391e6dd.tar.bz2
Show '\011', '\012', and '\015' as '\t', '\n', '\r' in strings.
Switch from octal escapes to hex escapes for other nonprintable characters.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/liblinecache.tex2
-rw-r--r--Doc/lib/liblocale.tex2
-rw-r--r--Doc/lib/libmd5.tex4
-rw-r--r--Doc/lib/libparser.tex4
-rw-r--r--Doc/lib/libpyexpat.tex4
-rw-r--r--Doc/lib/librotor.tex14
-rw-r--r--Doc/lib/libstruct.tex4
-rw-r--r--Doc/tut/tut.tex20
8 files changed, 23 insertions, 31 deletions
diff --git a/Doc/lib/liblinecache.tex b/Doc/lib/liblinecache.tex
index f491d4c..8a9b914 100644
--- a/Doc/lib/liblinecache.tex
+++ b/Doc/lib/liblinecache.tex
@@ -41,5 +41,5 @@ Example:
\begin{verbatim}
>>> import linecache
>>> linecache.getline('/etc/passwd', 4)
-'sys:x:3:3:sys:/dev:/bin/sh\012'
+'sys:x:3:3:sys:/dev:/bin/sh\n'
\end{verbatim}
diff --git a/Doc/lib/liblocale.tex b/Doc/lib/liblocale.tex
index 974d696..107c21d 100644
--- a/Doc/lib/liblocale.tex
+++ b/Doc/lib/liblocale.tex
@@ -265,7 +265,7 @@ Example:
>>> import locale
>>> loc = locale.setlocale(locale.LC_ALL) # get current locale
>>> locale.setlocale(locale.LC_ALL, 'de') # use German locale
->>> locale.strcoll('f\344n', 'foo') # compare a string containing an umlaut
+>>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut
>>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
>>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale
>>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
diff --git a/Doc/lib/libmd5.tex b/Doc/lib/libmd5.tex
index bec1132..f471bae 100644
--- a/Doc/lib/libmd5.tex
+++ b/Doc/lib/libmd5.tex
@@ -25,14 +25,14 @@ the spammish repetition'}:
>>> m.update("Nobody inspects")
>>> m.update(" the spammish repetition")
>>> m.digest()
-'\273d\234\203\335\036\245\311\331\336\311\241\215\360\377\351'
+'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'
\end{verbatim}
More condensed:
\begin{verbatim}
>>> md5.new("Nobody inspects the spammish repetition").digest()
-'\273d\234\203\335\036\245\311\331\336\311\241\215\360\377\351'
+'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'
\end{verbatim}
\begin{funcdesc}{new}{\optional{arg}}
diff --git a/Doc/lib/libparser.tex b/Doc/lib/libparser.tex
index 96256ad..9ff3f42 100644
--- a/Doc/lib/libparser.tex
+++ b/Doc/lib/libparser.tex
@@ -432,7 +432,7 @@ buried deep in nested tuples.
(297,
(298,
(299,
- (300, (3, '"""Some documentation.\012"""'))))))))))))))))),
+ (300, (3, '"""Some documentation.\n"""'))))))))))))))))),
(4, ''))),
(4, ''),
(0, ''))
@@ -537,7 +537,7 @@ module docstring from the parse tree created previously is easy:
>>> found
1
>>> vars
-{'docstring': '"""Some documentation.\012"""'}
+{'docstring': '"""Some documentation.\n"""'}
\end{verbatim}
Once specific data can be extracted from a location where it is
diff --git a/Doc/lib/libpyexpat.tex b/Doc/lib/libpyexpat.tex
index 27edc08..b50c52d 100644
--- a/Doc/lib/libpyexpat.tex
+++ b/Doc/lib/libpyexpat.tex
@@ -272,11 +272,11 @@ Start element: parent {'id': 'top'}
Start element: child1 {'name': 'paul'}
Character data: 'Text goes here'
End element: child1
-Character data: '\012'
+Character data: '\n'
Start element: child2 {'name': 'fred'}
Character data: 'More text'
End element: child2
-Character data: '\012'
+Character data: '\n'
End element: parent
\end{verbatim}
diff --git a/Doc/lib/librotor.tex b/Doc/lib/librotor.tex
index ba7c402..e1db8ef 100644
--- a/Doc/lib/librotor.tex
+++ b/Doc/lib/librotor.tex
@@ -68,17 +68,17 @@ An example usage:
>>> import rotor
>>> rt = rotor.newrotor('key', 12)
>>> rt.encrypt('bar')
-'\2534\363'
+'\xab4\xf3'
>>> rt.encryptmore('bar')
-'\357\375$'
+'\xef\xfd$'
>>> rt.encrypt('bar')
-'\2534\363'
->>> rt.decrypt('\2534\363')
+'\xab4\xf3'
+>>> rt.decrypt('\xab4\xf3')
'bar'
->>> rt.decryptmore('\357\375$')
+>>> rt.decryptmore('\xef\xfd$')
'bar'
->>> rt.decrypt('\357\375$')
-'l(\315'
+>>> rt.decrypt('\xef\xfd$')
+'l(\xcd'
>>> del rt
\end{verbatim}
diff --git a/Doc/lib/libstruct.tex b/Doc/lib/libstruct.tex
index 434b433..637d3e6 100644
--- a/Doc/lib/libstruct.tex
+++ b/Doc/lib/libstruct.tex
@@ -168,8 +168,8 @@ big-endian machine):
\begin{verbatim}
>>> from struct import *
>>> pack('hhl', 1, 2, 3)
-'\000\001\000\002\000\000\000\003'
->>> unpack('hhl', '\000\001\000\002\000\000\000\003')
+'\x00\x01\x00\x02\x00\x00\x00\x03'
+>>> unpack('hhl', '\x00\x01\x00\x02\x00\x00\x00\x03')
(1, 2, 3)
>>> calcsize('hhl')
8
diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex
index 86014a8..8a47b22 100644
--- a/Doc/tut/tut.tex
+++ b/Doc/tut/tut.tex
@@ -801,24 +801,24 @@ Apart from these standard encodings, Python provides a whole set of
other ways of creating Unicode strings on the basis of a known
encoding.
-The builtin \function{unicode()}\bifuncindex{unicode} provides access
+The built-in function \function{unicode()}\bifuncindex{unicode} provides access
to all registered Unicode codecs (COders and DECoders). Some of the
more well known encodings which these codecs can convert are
\emph{Latin-1}, \emph{ASCII}, \emph{UTF-8} and \emph{UTF-16}. The latter two
-are variable length encodings which permit to store Unicode characters
-in 8 or 16 bits. Python uses UTF-8 as default encoding. This becomes
-noticeable when printing Unicode strings or writing them to files.
+are variable-length encodings which store Unicode characters
+in blocks of 8 or 16 bits. To print a Unicode string or write it to a file,
+you must convert it to a string with the \method{encode()} method.
\begin{verbatim}
>>> u"äöü"
u'\344\366\374'
->>> str(u"äöü")
+>>> u"äöü".encode('UTF-8')
'\303\244\303\266\303\274'
\end{verbatim}
If you have data in a specific encoding and want to produce a
corresponding Unicode string from it, you can use the
-\function{unicode()} builtin with the encoding name as second
+\function{unicode()} function with the encoding name as second
argument.
\begin{verbatim}
@@ -826,14 +826,6 @@ argument.
u'\344\366\374'
\end{verbatim}
-To convert the Unicode string back into a string using the original
-encoding, the objects provide an \method{encode()} method.
-
-\begin{verbatim}
->>> u"äöü".encode('UTF-8')
-'\303\244\303\266\303\274'
-\end{verbatim}
-
\subsection{Lists \label{lists}}