Package: python2.5-minimal
Version: 2.5.4-1
Severity: normal
Tags: l10n

When trying to execute this in an IDE (i tried in Netbeans, and in gedit with 
the external command execution feature), python throws an UnicodeEncodeError:

#! /usr/bin/env python
# -*- coding: utf-8 -*-
print u"éáőöóúü"

The result of executing:

Traceback (most recent call last):
  File "/home/darkelf/webdev/tv/port.hu.py", line 3, in <module>
    print u"eéaáoőöóuúü"
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: 
ordinal not in range(128)

The root of the problem is that the default encoding is set to ascii, and there 
are no accented characters in that character set, so python cannot print the 
string in ascii.
More about python and the default encoding: 
http://www.diveintopython.org/xml_processing/unicode.html
If i try to run the same script in a console, it works fine, but i don't know 
why.
The solution is to change the default encoding to utf-8 in 
/etc/python2.5/sitecustomize.py, and then everything works fine in IDEs and 
console too.
It means adding of these lines:

# set the default encoding
import sys
sys.setdefaultencoding('utf-8')

Sorry but i dont know how to use the patch tool, so i didn't attach a patch, 
but it should be trivial to make the patch if you are familiar with this tool.



-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core)
Locale: LANG=hu_HU.UTF-8, LC_CTYPE=hu_HU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python2.5-minimal depends on:
ii  libc6                  2.9-12            GNU C Library: Shared libraries
ii  zlib1g                 1:1.2.3.3.dfsg-13 compression library - runtime

Versions of packages python2.5-minimal recommends:
ii  python2.5                     2.5.4-1    An interactive high-level object-o

Versions of packages python2.5-minimal suggests:
ii  binfmt-support                1.2.11     Support for extra binary formats

-- 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

Reply via email to