From 4a02fe2899f37da4bebd7ba48907a8b5c9a0c73c Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Fri, 15 Jun 2012 18:27:51 +0200 Subject: [PATCH] force encoding to utf8 --- bat2nodes.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bat2nodes.py b/bat2nodes.py index eab7569..661af50 100755 --- a/bat2nodes.py +++ b/bat2nodes.py @@ -11,6 +11,15 @@ import argparse from nodedb import NodeDB from d3mapbuilder import D3MapBuilder +# Force encoding to UTF-8 +import locale # Ensures that subsequent open()s +locale.getpreferredencoding = lambda: 'UTF-8' # are UTF-8 encoded. + +import sys +sys.stdin = open('/dev/stdin', 'r') +sys.stdout = open('/dev/stdout', 'w') +sys.stderr = open('/dev/stderr', 'w') + parser = argparse.ArgumentParser() parser.add_argument('-a', '--aliases',