summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/elog/mod_save.py4
-rw-r--r--pym/portage/elog/mod_save_summary.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/pym/portage/elog/mod_save.py b/pym/portage/elog/mod_save.py
index 35c433828..836aea24f 100644
--- a/pym/portage/elog/mod_save.py
+++ b/pym/portage/elog/mod_save.py
@@ -3,6 +3,7 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
+import codecs
import os, time
from portage.data import portage_uid, portage_gid
from portage.util import ensure_dirs
@@ -17,7 +18,8 @@ def process(mysettings, key, logentries, fulltext):
ensure_dirs(elogdir, uid=portage_uid, gid=portage_gid, mode=02770)
elogfilename = elogdir+"/"+path+":"+time.strftime("%Y%m%d-%H%M%S", time.gmtime(time.time()))+".log"
- elogfile = open(elogfilename, "w")
+ elogfile = codecs.open(elogfilename, mode='w',
+ encoding='utf_8', errors='replace')
elogfile.write(fulltext)
elogfile.close()
diff --git a/pym/portage/elog/mod_save_summary.py b/pym/portage/elog/mod_save_summary.py
index 0e12ac451..698eeae09 100644
--- a/pym/portage/elog/mod_save_summary.py
+++ b/pym/portage/elog/mod_save_summary.py
@@ -3,6 +3,7 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
+import codecs
import os, time
from portage.data import portage_uid, portage_gid
from portage.localization import _
@@ -17,7 +18,8 @@ def process(mysettings, key, logentries, fulltext):
# TODO: Locking
elogfilename = elogdir+"/summary.log"
- elogfile = open(elogfilename, "a")
+ elogfile = codecs.open(elogfilename, mode='a',
+ encoding='utf_8', errors='replace')
apply_permissions(elogfilename, mode=060, mask=0)
elogfile.write(_(">>> Messages generated by process %(pid)d on %(time)s for package %(pkg)s:\n\n") %
{"pid": os.getpid(), "time": time.strftime("%Y-%m-%d %H:%M:%S %Z", time.localtime(time.time())), "pkg": key})