projects
/
tools
/
mic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eee8ddf
)
encode unicode string from system w/ widechar locale
author
JF Ding
<jian-feng.ding@intel.com>
Sun, 24 Jun 2012 14:43:15 +0000
(07:43 -0700)
committer
JF Ding
<jian-feng.ding@intel.com>
Sun, 24 Jun 2012 14:43:15 +0000
(07:43 -0700)
else in this like system, msger will abort with
string encoding/decoding errors.
mic/msger.py
patch
|
blob
|
history
diff --git
a/mic/msger.py
b/mic/msger.py
index
8413f64
..
33f4298
100644
(file)
--- a/
mic/msger.py
+++ b/
mic/msger.py
@@
-71,6
+71,10
@@
def _general_print(head, color, msg = None, stream = None, level = 'normal'):
# skip
return
+ # encode raw 'unicode' str to utf8 encoded str
+ if msg and isinstance(msg, unicode):
+ msg = msg.encode('utf-8', 'ignore')
+
errormsg = ''
if CATCHERR_BUFFILE_FD > 0:
size = os.lseek(CATCHERR_BUFFILE_FD , 0, os.SEEK_END)