[Bug 1243065] Re: Invalid encoding returned for ca at valencia locale
Chris Guiver
1243065 at bugs.launchpad.net
Sat May 22 08:14:34 UTC 2021
Thank you for reporting this bug to Ubuntu.
Ubuntu 13.10 (saucy) reached end-of-life on July 17, 2014.
Ubuntu 13.04 (raring) reached end-of-life on January 27, 2014.
See this document for currently supported Ubuntu releases:
https://wiki.ubuntu.com/Releases
We appreciate that this bug may be old and you might not be interested
in discussing it any more. But if you are then please upgrade to the
latest Ubuntu version and re-test. If you then find the bug is still
present in the newer Ubuntu version, please add a comment here telling
us which new version it is in.
** Changed in: ubuntu-release-upgrader (Ubuntu)
Status: Triaged => Incomplete
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ubuntu-release-upgrader in
Ubuntu.
https://bugs.launchpad.net/bugs/1243065
Title:
Invalid encoding returned for ca at valencia locale
Status in Python:
Confirmed
Status in ubuntu-release-upgrader package in Ubuntu:
Incomplete
Bug description:
While upgrading from 13.04 to 13.10 using locale ca at valencia, the
process fails with the following traceback:
Traceback (most recent call last):
File "/tmp/ubuntu-release-upgrader-vh1jgw/saucy", line 10, in
<module>
sys.exit(main())
File
"/tmp/ubuntu-release-upgrader-vh1jgw/DistUpgrade/DistUpgradeMain.py",
line 243, in main
if app.run():
File
"/tmp/ubuntu-release-upgrader-vh1jgw/DistUpgrade/DistUpgradeController.py",
line 1791, in run
return self.fullUpgrade()
File
"/tmp/ubuntu-release-upgrader-vh1jgw/DistUpgrade/DistUpgradeController.py",
line 1744, in fullUpgrade
if not self.askDistUpgrade():
File
"/tmp/ubuntu-release-upgrader-vh1jgw/DistUpgrade/DistUpgradeController.py",
line 996, in askDistUpgrade
self.cache.required_download)
File
"/tmp/ubuntu-release-upgrader-vh1jgw/DistUpgrade/DistUpgradeViewText.py",
line 165, in confirmChanges
downloadSize, actions)
File
"/tmp/ubuntu-release-upgrader-vh1jgw/DistUpgrade/DistUpgradeView.py",
line 387, in confirmChanges
downloadSizeStr = downloadSizeStr.decode(ENCODING)
LookupError: unknown encoding: utf_8_valencia
Looking at it in more detail, this comes from the following code in
DistUpgrade/DistUpgradeView.py [1]
try:
locale.setlocale(locale.LC_ALL, "")
(code, ENCODING) = locale.getdefaultlocale()
except:
logging.exception("getting the encoding failed")
ENCODING = "utf-8" #pyflakes
if not ENCODING:
ENCODING = "utf-8"
And digging deeper, it seems getdefaultlocale does not return the
correct encoding when the locale is set to ca_ES
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'LC_CTYPE=ca_ES.UTF-8 at valencia;LC_NUMERIC=ca_ES.UTF-8;LC_TIME=ca_ES.UTF-8;LC_COLLATE=ca_ES.UTF-8 at valencia;LC_MONETARY=ca_ES.UTF-8;LC_MESSAGES=ca_ES.UTF-8 at valencia;LC_PAPER=ca_ES.UTF-8;LC_NAME=ca_ES.UTF-8;LC_ADDRESS=ca_ES.UTF-8;LC_TELEPHONE=ca_ES.UTF-8;LC_MEASUREMENT=ca_ES.UTF-8;LC_IDENTIFICATION=ca_ES.UTF-8'
>>> locale.getdefaultlocale()
('ca_ES', 'utf_8_valencia')
Instead of 'utf_8_valencia', here I'd expect 'UTF-8' to be returned.
The returned locale is also wrong: it should be ca_ES at valencia.
While this needs to be fixed upstream, it might be worth adding a
workaround (and a check for a valid encoding) in ubuntu-release-
upgrader in the meantime.
This will also affect other @ locales, such as sr at Latin (Serbian with
Latin encoding).
[1] http://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu-release-
upgrader/trunk/view/head:/DistUpgrade/DistUpgradeView.py#L41
To manage notifications about this bug go to:
https://bugs.launchpad.net/python/+bug/1243065/+subscriptions
More information about the foundations-bugs
mailing list