[Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.125,1.126

Ka-Ping Yee ping@users.sourceforge.net
Wed, 24 Jan 2001 09:19:10 -0800


Update of /cvsroot/python/python/dist/src/Doc/tut
In directory usw-pr-cvs1:/tmp/cvs-serv10747/Doc/tut

Modified Files:
	tut.tex 
Log Message:
Show '\011', '\012', and '\015' as '\t', '\n', '\r' in strings.
Switch from octal escapes to hex escapes for other nonprintable characters.


Index: tut.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v
retrieving revision 1.125
retrieving revision 1.126
diff -C2 -r1.125 -r1.126
*** tut.tex	2001/01/19 22:34:59	1.125
--- tut.tex	2001/01/24 17:19:07	1.126
***************
*** 802,817 ****
  encoding. 
  
! The builtin \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.
  
  \begin{verbatim}
  >>> u"äöü"
  u'\344\366\374'
! >>> str(u"äöü")
  '\303\244\303\266\303\274'
  \end{verbatim}
--- 802,817 ----
  encoding. 
  
! 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 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'
! >>> u"äöü".encode('UTF-8')
  '\303\244\303\266\303\274'
  \end{verbatim}
***************
*** 819,823 ****
  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
  argument.
  
--- 819,823 ----
  If you have data in a specific encoding and want to produce a
  corresponding Unicode string from it, you can use the
! \function{unicode()} function with the encoding name as second
  argument.
  
***************
*** 825,836 ****
  >>> unicode('\303\244\303\266\303\274','UTF-8')
  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}
  
--- 825,828 ----