Bug#528614: python2.5: Fails badly at handling Unicode with piped/redirected stdout

2009-05-14 Thread Cyril Brulebois
Package: python2.5
Version: 2.5.4-1
Severity: important

Hi.

Either I'm on crack, or python is. Transcript:
| -(jobs:1)-(cy...@talisker pts/7)-(~)
| $ ./python-wtf.py   
| KïBï
| -(jobs:1)-(cy...@talisker pts/7)-(~)
| $ ./python-wtf.py  /dev/null
| Traceback (most recent call last):
|   File ./python-wtf.py, line 4, in module
| print u'KïBï'
| UnicodeEncodeError: 'ascii' codec can't encode character u'\xef' in position 
1: ordinal not in range(128)
| -(jobs:1)-(cy...@talisker pts/7)-(~)
| ret:1$ ./python-wtf.py  fubar
| Traceback (most recent call last):
|   File ./python-wtf.py, line 4, in module
| print u'KïBï'
| UnicodeEncodeError: 'ascii' codec can't encode character u'\xef' in position 
1: ordinal not in range(128)
| -(jobs:1)-(cy...@talisker pts/7)-(~)
| ret:1$ locale
| LANG=fr_FR.UTF-8
| LC_CTYPE=fr_FR.UTF-8
| LC_NUMERIC=fr_FR.UTF-8
| LC_TIME=fr_FR.UTF-8
| LC_COLLATE=fr_FR.UTF-8
| LC_MONETARY=fr_FR.UTF-8
| LC_MESSAGES=fr_FR.UTF-8
| LC_PAPER=fr_FR.UTF-8
| LC_NAME=fr_FR.UTF-8
| LC_ADDRESS=fr_FR.UTF-8
| LC_TELEPHONE=fr_FR.UTF-8
| LC_MEASUREMENT=fr_FR.UTF-8
| LC_IDENTIFICATION=fr_FR.UTF-8
| LC_ALL=
| -(jobs:1)-(cy...@talisker pts/7)-(~)
| $ cat python-wtf.py 
| #!/usr/bin/python
| # -*- coding: utf-8 -*-
| 
| print u'KïBï'

Same result with “| less”, for example.

The script as also attached for your convenience.

Also happens with python2.4 (2.4.6-2).

Mraw,
KiBi.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python2.5 depends on:
ii  libbz2-1.01.0.5-1high-quality block-sorting file co
ii  libc6 2.9-12 GNU C Library: Shared libraries
ii  libdb4.5  4.5.20-13  Berkeley v4.5 Database Libraries [
ii  libncursesw5  5.7+20090502-1 shared libraries for terminal hand
ii  libreadline5  5.2-4  GNU readline and history libraries
ii  libsqlite3-0  3.6.13-1   SQLite 3 shared library
ii  libssl0.9.8   0.9.8g-16  SSL shared libraries
ii  mime-support  3.44-1 MIME files 'mime.types'  'mailcap
ii  python2.5-minimal 2.5.4-1A minimal subset of the Python lan

python2.5 recommends no packages.

Versions of packages python2.5 suggests:
pn  python-profiler   none (no description available)
ii  python2.5-doc 2.5.4-1Documentation for the high-level o

-- no debconf information



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#528614: python2.5: Fails badly at handling Unicode with piped/redirected stdout

2009-05-14 Thread Cyril Brulebois
Cyril Brulebois k...@debian.org (14/05/2009):
 The script as also attached for your convenience.

Or forgotten. :)

Any UTF-8 string would do, anyway.

Mraw,
KiBi.
#!/usr/bin/python
# -*- coding: utf-8 -*-

print u'KïBï'


signature.asc
Description: Digital signature