diff options
-rw-r--r-- | pym/portage/util.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pym/portage/util.py b/pym/portage/util.py index 49eec6492..f1bff1d40 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -56,6 +56,9 @@ def writemsg(mystr,noiselevel=0,fd=None): if fd is None: fd = sys.stderr if noiselevel <= noiselimit: + if sys.hexversion < 0x3000000 and isinstance(mystr, unicode): + # avoid potential UnicodeEncodeError + mystr = mystr.encode('utf_8', 'replace') fd.write(mystr) fd.flush() |