apport-cli, apport-kde crashed with UnicodeEncodeError in many places
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apport (Ubuntu) |
Expired
|
Medium
|
Unassigned |
Bug Description
apport does not manage stdio/stdout encoding correctly, it crashed if there is non ascii charsets. Users can not submit issue in many locales, need to switch LANGUAGE to en_US.
ProblemType: Crash
DistroRelease: Ubuntu 11.10
Package: apport 1.21.2-0ubuntu14
ProcVersionSign
Uname: Linux 3.0.0-8-generic x86_64
Architecture: amd64
Date: Tue Aug 16 11:45:00 2011
ExecutablePath: /usr/bin/apport-cli
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110426)
InterpreterPath: /usr/bin/python2.7
PackageArchitec
ProcCmdline: /usr/bin/python /usr/bin/apport-cli /var/crash/
ProcEnviron:
LANG=en_US.UTF-8
SHELL=/bin/bash
PATH=(custom, user)
LC_MESSAGES=
LANGUAGE=zh_TW:zh
PythonArgs: ['/usr/
SourcePackage: apport
Title: apport-cli crashed with UnicodeEncodeError in communicate(): 'ascii' codec can't encode characters in position 40-42: ordinal not in range(128)
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm admin cdrom dialout libvirtd lpadmin plugdev sambashare vboxusers
Changed in apport (Ubuntu): | |
status: | New → Confirmed |
tags: | removed: need-duplicate-check |
summary: |
- apport-cli crashed with UnicodeEncodeError in communicate(): 'ascii' - codec can't encode characters in position 40-42: ordinal not in - range(128) + apport-cli crashed with UnicodeEncodeError in many places |
tags: |
added: l10n removed: amd64 oneiric running-unity |
description: | updated |
tags: | added: oneiric precise |
summary: |
- apport-cli crashed with UnicodeEncodeError in many places + apport-cli, apport-kde crashed with UnicodeEncodeError in many places |
By default, the python 2.7 on Ubuntu/Debian is using ascii as default encoding. There is an option in /usr/lib/ python2. 7/site. py, user can enable to support locale aware default string encodings, which is a system wide setting.
The better approach is to switch the default encoding to user's setting. Like
import locale getdefaultlocal e()
encoding = 'ascii'
loc = locale.
if loc[1]:
encoding = loc[1]
sys.setdefaulte ncoding( encoding)