diff --git a/moin2doku.py b/moin2doku.py index 3ab7887..827784c 100755 --- a/moin2doku.py +++ b/moin2doku.py @@ -227,6 +227,15 @@ def convertfile(pagedir, output = None, overwrite = False): # # "main" starts here # + +# setup utf8 output +if sys.stdout.isatty(): + default_encoding = sys.stdout.encoding +else: + import locale + default_encoding = locale.getpreferredencoding() +sys.stdout = codecs.getwriter(default_encoding)(sys.stdout); + try: opts, args = getopt.getopt(sys.argv[1:], 'hfad:F:r:', [ "help" ]) except getopt.GetoptError, e: