From beb384007d4c0df97505150dc25215d6657dc1ca Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 6 Aug 2009 22:44:45 +0000 Subject: [PATCH] In getconfig(), specify utf_8 encoding for py3k. svn path=/main/trunk/; revision=13943 --- pym/portage/util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: -- 2.26.2