浏览代码

https://trac.osgeo.org/grass/ticket/1295 (Wx location wizard fails to create location if it's title
contains non-latin letters) - write MYNAME using encoding utf-8


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45550 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 14 年之前
父节点
当前提交
5bc5bf6370
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      lib/python/core.py

+ 4 - 2
lib/python/core.py

@@ -31,6 +31,7 @@ import atexit
 import subprocess
 import shutil
 import locale
+import codecs
 
 # i18N
 import gettext
@@ -1017,8 +1018,9 @@ def create_location(dbase, location,
             raise ScriptException(repr(error))
 
     try:
-        fd = open(os.path.join(dbase, location,
-                               'PERMANENT', 'MYNAME'), 'w')
+        fd = codecs.open(os.path.join(dbase, location,
+                                      'PERMANENT', 'MYNAME'),
+                         encoding = 'utf-8', mode = 'w')
         if desc:
             fd.write(desc + os.linesep)
         else: