diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-08-06 22:44:45 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-08-06 22:44:45 +0000 |
commit | beb384007d4c0df97505150dc25215d6657dc1ca (patch) | |
tree | 60e952d7061b5a410e6fe6646fc4c5e6f23f5b8d | |
parent | 5c204ae352691ba5bfe1df0e7d3440f048c7d934 (diff) | |
download | portage-beb384007d4c0df97505150dc25215d6657dc1ca.tar.gz portage-beb384007d4c0df97505150dc25215d6657dc1ca.tar.bz2 portage-beb384007d4c0df97505150dc25215d6657dc1ca.zip |
In getconfig(), specify utf_8 encoding for py3k.
svn path=/main/trunk/; revision=13943
-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: |