Browse Source

wxPython GUI: Set the default encoding based on LC_CTYPE. Fix tickets https://trac.osgeo.org/grass/ticket/1856 and https://trac.osgeo.org/grass/ticket/2120.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60307 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 11 years ago
parent
commit
04a23e55c5
2 changed files with 18 additions and 1 deletions
  1. 1 1
      gui/wxpython/Makefile
  2. 17 0
      gui/wxpython/sitecustomize.py

+ 1 - 1
gui/wxpython/Makefile

@@ -14,7 +14,7 @@ SRCFILES := $(wildcard icons/*.py scripts/*.py xml/*) \
 	gui_core/*.py iclass/* lmgr/*.py location_wizard/*.py mapwin/*.py mapdisp/*.py \
 	gui_core/*.py iclass/* lmgr/*.py location_wizard/*.py mapwin/*.py mapdisp/*.py \
 	mapswipe/* modules/*.py nviz/*.py psmap/* rlisetup/* timeline/* vdigit/* \
 	mapswipe/* modules/*.py nviz/*.py psmap/* rlisetup/* timeline/* vdigit/* \
 	vnet/*.py web_services/*.py wxplot/*.py iscatt/*.py) \
 	vnet/*.py web_services/*.py wxplot/*.py iscatt/*.py) \
-	gis_set.py gis_set_error.py wxgui.py README
+	sitecustomize.py gis_set.py gis_set_error.py wxgui.py README
 
 
 DSTFILES := $(patsubst %,$(DSTDIR)/%,$(SRCFILES)) \
 DSTFILES := $(patsubst %,$(DSTDIR)/%,$(SRCFILES)) \
 	$(patsubst %.py,$(DSTDIR)/%.pyc,$(filter %.py,$(SRCFILES)))
 	$(patsubst %.py,$(DSTDIR)/%.pyc,$(filter %.py,$(SRCFILES)))

+ 17 - 0
gui/wxpython/sitecustomize.py

@@ -0,0 +1,17 @@
+"""!
+Default encoding for wxPython GRASS GUI.
+
+(C) 2014 by the GRASS Development Team
+
+This program is free software under the GNU General Public License
+(>=v2). Read the file COPYING that comes with GRASS for details.
+
+@author Huidae Cho <grass4u gmail.com>
+"""
+
+import os
+import sys
+
+lang = os.environ["LC_CTYPE"].split(".")
+if len(lang) == 2:
+    sys.setdefaultencoding(lang[1].lower())