Your message dated Thu, 19 Nov 2009 10:28:01 -0600
with message-id <[email protected]>
and subject line Re: Bug#538844: python2.5-minimal: default encoding should be
utf-8
has caused the Debian Bug report #538844,
regarding python2.5-minimal: default encoding should be utf-8
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
538844: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=538844
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
tag 538844 + wontfix
thanks
On 27.07.2009 07:32, Molnár Gábor wrote:
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')
no, python2.x will never have utf-8 default encoding. python3 does have this.
--- End Message ---