# License: GPL2
# $Id$
+import codecs
from portage.cache import fs_template
from portage.cache import cache_errors
import errno, os, stat
def _getitem(self, cpv):
fp = os.path.join(self.location, cpv)
try:
- myf = open(fp, "r")
+ myf = codecs.open(fp, mode='r', encoding='utf_8', errors='replace')
try:
d = self._parse_data(myf, cpv)
if '_mtime_' not in d:
s = cpv.rfind("/")
fp = os.path.join(self.location,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
try:
- myf = open(fp, 'w')
+ myf = codecs.open(fp, mode='w',
+ encoding='utf_8', errors='replace')
except (IOError, OSError), e:
if errno.ENOENT == e.errno:
try:
self._ensure_dirs(cpv)
- myf=open(fp,"w")
+ myf = codecs.open(fp, mode='w',
+ encoding='utf_8', errors='replace')
except (OSError, IOError),e:
raise cache_errors.CacheCorruption(cpv, e)
else: