[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
- Previous message: [Python-checkins] CVS: python/dist/src/Doc/lib liblinecache.tex,1.4,1.5 liblocale.tex,1.21,1.22 libmd5.tex,1.18,1.19 libparser.tex,1.36,1.37 libpyexpat.tex,1.11,1.12 librotor.tex,1.17,1.18 libstruct.tex,1.25,1.26
- Next message: [Python-checkins] CVS: python/dist/src/Lib/test/output test_cfgparser,1.1,1.2 test_cookie,1.3,1.4 test_tokenize,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
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 ----
- Previous message: [Python-checkins] CVS: python/dist/src/Doc/lib liblinecache.tex,1.4,1.5 liblocale.tex,1.21,1.22 libmd5.tex,1.18,1.19 libparser.tex,1.36,1.37 libpyexpat.tex,1.11,1.12 librotor.tex,1.17,1.18 libstruct.tex,1.25,1.26
- Next message: [Python-checkins] CVS: python/dist/src/Lib/test/output test_cfgparser,1.1,1.2 test_cookie,1.3,1.4 test_tokenize,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]