diff --git a/oml/media/txt.py b/oml/media/txt.py index a247016..362f946 100644 --- a/oml/media/txt.py +++ b/oml/media/txt.py @@ -28,8 +28,8 @@ def info(path): return data def extract_text(path): - with open(path) as fd: - data = fd.read() + with open(path, 'rb') as fd: + data = fd.read().decode('utf-8', errors='replace') return data def extract_isbn(text): diff --git a/oml/node/server.py b/oml/node/server.py index d4a7266..e921a4b 100644 --- a/oml/node/server.py +++ b/oml/node/server.py @@ -55,7 +55,7 @@ class NodeHandler(tornado.web.RequestHandler): content = settings.release else: if valid(key, data, sig): - action, args = json.loads(data) + action, args = json.loads(data.decode('utf-8')) logger.debug('NODE action %s %s (%s)', action, args, key) if action == 'ping': content = { diff --git a/static/txt.js/txt.py b/static/txt.js/txt.py index f4daf19..d34e5c4 100755 --- a/static/txt.js/txt.py +++ b/static/txt.js/txt.py @@ -28,7 +28,7 @@ def render(infile, outfile): for line in f: - for line_ in line.decode('utf-8').strip().split('\r'): + for line_ in line.strip().split('\r'): lines = wrapText( line_,