Skip to content
Snippets Groups Projects
Commit 0409ac08 authored by Sébastien Luttringer's avatar Sébastien Luttringer
Browse files

convert printed message regarding current locale

parent 48889414
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@
Install Systems Printer module
'''
import locale
import sys
import os
import re
......@@ -58,7 +59,7 @@ def out(message="", fd=sys.stdout, endl=os.linesep, flush=True):
# convert unicode into str before write
# this can cause issue on python 2.6
if type(message) == unicode:
message = message.encode("utf8")
message = message.encode(locale.getpreferredencoding(), errors='replace')
# printing
fd.write("%s%s" % (message, endl))
if flush:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment