[GRASS-SVN] r70767 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 18 22:06:57 PDT 2017


Author: hcho
Date: 2017-03-18 22:06:57 -0700 (Sat, 18 Mar 2017)
New Revision: 70767

Modified:
   grass/trunk/lib/init/grass.py
Log:
grass.py: Force encoding to be EUC-KR for the Korean language in Windows

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2017-03-18 14:59:18 UTC (rev 70766)
+++ grass/trunk/lib/init/grass.py	2017-03-19 05:06:57 UTC (rev 70767)
@@ -1171,15 +1171,25 @@
     # Set up environment for subprocesses
     os.environ['LANGUAGE'] = language
     os.environ['LANG'] = language
-    if encoding:
+
+    if language == 'ko_KR' and encoding == 'cp949':
+        # The default encoding for the Korean language in Windows is cp949,
+        # Microsoft's proprietary extension to euc-kr, but gettext prints no
+        # translated messages at all in the Command Prompt window if LC_CTYPE
+        # is set to ko_KR.cp949. Here, force LC_CTYPE to be euc-kr.
+        normalized = 'euc-kr'
+        encoding = None
+    elif encoding:
         normalized = locale.normalize('%s.%s' % (language, encoding))
     else:
         normalized = language
+
     for lc in ('LC_CTYPE', 'LC_MESSAGES', 'LC_TIME', 'LC_COLLATE',
                'LC_MONETARY', 'LC_PAPER', 'LC_NAME', 'LC_ADDRESS',
                'LC_TELEPHONE', 'LC_MEASUREMENT', 'LC_IDENTIFICATION'):
         os.environ[lc] = normalized
 
+
     # Some code in GRASS might not like other decimal separators than .
     # Other potential sources for problems are: LC_TIME LC_CTYPE
     locale.setlocale(locale.LC_NUMERIC, 'C')



More information about the grass-commit mailing list