Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   utf-8 in interactive python session (http://www.velocityreviews.com/forums/t336385-utf-8-in-interactive-python-session.html)

Luke 09-30-2004 06:36 AM

utf-8 in interactive python session
 
Python doesn't seem to read UTF-8 properly from an interactive
session. Am I doing something wrong?

luked@sor ~ $ echo $LANG
en_AU.UTF-8
luked@sor ~ $ python
Python 2.3.4 (#1, Aug 12 2004, 17:23:54)
[GCC 3.4.1 (Gentoo Linux 3.4.1, ssp-3.4-2, pie-8.7.6.3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.getdefaultencoding()

utf-8
>>> u'π' # embedded greek letter 'pi' (possibly mangled by

google groups news client), should return u'\u03c0'
u'\xcf\x80'
>>> u'\u03c0'.encode()

'\xcf\x80'
>>>


09-30-2004 07:10 AM

Re: utf-8 in interactive python session
 
The problem is fixed in Python 2.4a2 and its later versions.
Please try one of them. :)

Hye-Shik

On 29 Sep 2004 23:36:48 -0700, Luke <luke@deller.id.au> wrote:
> Python doesn't seem to read UTF-8 properly from an interactive
> session. Am I doing something wrong?
>
> luked@sor ~ $ echo $LANG
> en_AU.UTF-8
> luked@sor ~ $ python
> Python 2.3.4 (#1, Aug 12 2004, 17:23:54)
> [GCC 3.4.1 (Gentoo Linux 3.4.1, ssp-3.4-2, pie-8.7.6.3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> print sys.getdefaultencoding()

> utf-8
> >>> u'π' # embedded greek letter 'pi' (possibly mangled by

> google groups news client), should return u'\u03c0'
> u'\xcf\x80'
> >>> u'\u03c0'.encode()

> '\xcf\x80'
> >>>



All times are GMT. The time now is 11:31 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57