Fix error under Cygwin Python:
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 15 May 2016 23:45:44 +0300
changeset 463 6eb9d9e1067a
parent 462 913f2f1c511d
child 464 5775915d15dc
Fix error under Cygwin Python: File "/usr/lib/python3.4/encodings/cp1251.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to <undefined>
py/gadict_c5.py
--- a/py/gadict_c5.py	Sun May 15 09:26:03 2016 +0300
+++ b/py/gadict_c5.py	Sun May 15 23:45:44 2016 +0300
@@ -3,6 +3,7 @@
 
 import io
 import sys
+import codecs
 
 import gadict
 
@@ -48,7 +49,7 @@
 if FONAME is None:
     FOUT = sys.stdout
 else:
-    FOUT = open(FONAME, "w")
+    FOUT = codecs.open(FONAME, "w", "utf-8")
 
 if PRELUDE.name is not None:
     FOUT.write("Dictionary name: ")