diff --git a/pidcat.py b/pidcat.py index 6a23786..6378884 100755 --- a/pidcat.py +++ b/pidcat.py @@ -359,4 +359,7 @@ def tag_in_tags_regex(tag, tags): message = matcher.sub(replace, message) linebuf += indent_wrap(message) - print(linebuf.encode('utf-8')) + if sys.stdout.encoding.upper() not in ['UTF-8', 'UTF8']: + print(linebuf.encode('utf-8')) + else: + print(linebuf)