setup utf8 output encoding
This commit is contained in:
parent
8411723b65
commit
de270d83ee
1 changed files with 9 additions and 0 deletions
|
@ -227,6 +227,15 @@ def convertfile(pagedir, output = None, overwrite = False):
|
||||||
#
|
#
|
||||||
# "main" starts here
|
# "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:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 'hfad:F:r:', [ "help" ])
|
opts, args = getopt.getopt(sys.argv[1:], 'hfad:F:r:', [ "help" ])
|
||||||
except getopt.GetoptError, e:
|
except getopt.GetoptError, e:
|
||||||
|
|
Loading…
Reference in a new issue