diff options
-rw-r--r-- | pym/portage/util.py | 6 |
1 files changed, 5 insertions, 1 deletions
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: |