Skip to content

Commit

Permalink
#54 Fix encoding issues in cortexutils
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jun 14, 2017
1 parent 1a8e21d commit 35fbe3e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions contrib/cortexutils/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
import json
from cortexutils.extractor import Extractor


class Analyzer:

def __init__(self):
#self.__set_encoding()
self.__set_encoding()

# Prepare in/out/err streams
self.fperror = sys.stderr
Expand Down Expand Up @@ -75,14 +76,12 @@ def __set_proxies(self):
def __set_encoding(self):
if sys.stdout.encoding != 'UTF-8':
if sys.version_info[0] == 3:
sys.stdout = codecs.getwriter(
'utf-8')(sys.stdout.buffer, 'strict')
sys.stdout = codecs.getwriter('utf-8')(sys.stdout.buffer, 'strict')
else:
sys.stdout = codecs.getwriter('utf-8')(sys.stdout, 'strict')
if sys.stderr.encoding != 'UTF-8':
if sys.version_info[0] == 3:
sys.stderr = codecs.getwriter(
'utf-8')(sys.stderr.buffer, 'strict')
sys.stderr = codecs.getwriter('utf-8')(sys.stderr.buffer, 'strict')
else:
sys.stderr = codecs.getwriter('utf-8')(sys.stderr, 'strict')

Expand Down

0 comments on commit 35fbe3e

Please sign in to comment.