From: Zac Medico Date: Thu, 6 Aug 2009 22:44:45 +0000 (-0000) Subject: In getconfig(), specify utf_8 encoding for py3k. X-Git-Tag: v2.2_rc37~23 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=beb384007d4c0df97505150dc25215d6657dc1ca;p=portage.git In getconfig(), specify utf_8 encoding for py3k. svn path=/main/trunk/; revision=13943 --- diff --git a/pym/portage/util.py b/pym/portage/util.py index 780c9b5f1..a12b8a18e 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -387,7 +387,11 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True): # trailing newline after the source statement # NOTE: shex doesn't seem to supported unicode objects # (produces spurious \0 characters with python-2.6.2) - content = open(mycfg).read() + if sys.hexversion < 0x3000000: + content = open(mycfg, 'rb').read() + else: + content = open(mycfg, mode='r', + encoding='utf_8', errors='replace').read() if content and content[-1] != '\n': content += '\n' except IOError, e: