From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QrLtF-0006v7-MP for garchives@archives.gentoo.org; Thu, 11 Aug 2011 03:25:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A442921C080; Thu, 11 Aug 2011 03:24:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 7691221C080 for ; Thu, 11 Aug 2011 03:24:39 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CE5581B4062 for ; Thu, 11 Aug 2011 03:24:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 9B4C28004B for ; Thu, 11 Aug 2011 03:24:37 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/utils.py X-VCS-Directories: layman/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: ee2ba4c60fb555f406b23aa3daf1c8fe5f35022d Date: Thu, 11 Aug 2011 03:24:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: f095dd71545969b9115bbd1fa698dffb commit: ee2ba4c60fb555f406b23aa3daf1c8fe5f35022d Author: dol-sen gmail com> AuthorDate: Wed Aug 10 01:04:21 2011 +0000 Commit: Brian Dolbec gmail com> CommitDate: Wed Aug 10 01:04:21 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/layman.git;a=3D= commit;h=3Dee2ba4c6 add the gentoolkit encoding bugfix --- layman/utils.py | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/layman/utils.py b/layman/utils.py index eedc5d7..6f144be 100644 --- a/layman/utils.py +++ b/layman/utils.py @@ -64,7 +64,16 @@ def get_encoding(output): and output.encoding !=3D None: return output.encoding else: - return locale.getpreferredencoding() + encoding =3D locale.getpreferredencoding() + # Make sure that python knows the encoding. Bug 350156 + try: + # We don't care about what is returned, we just want to + # verify that we can find a codec. + codecs.lookup(encoding) + except LookupError: + # Python does not know the encoding, so use utf-8. + encoding =3D 'utf_8' + return encoding =20 =20 def pad(string, length):