[GRASS-dev] [GRASS GIS] #1193: Python Menu: Japanese (double byte
character) in menu may cause parser error.
GRASS GIS
trac at osgeo.org
Fri Oct 8 04:40:34 EDT 2010
#1193: Python Menu: Japanese (double byte character) in menu may cause parser
error.
-------------------------+--------------------------------------------------
Reporter: naokiueda | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Python | Version: 6.4.0
Keywords: | Platform: MSWindows 7
Cpu: Unspecified |
-------------------------+--------------------------------------------------
In Japanese environment, r.reclass from menu GUI does not launched.
It is because Japanese character is double byte, and if first byte or
second bite is same code as '<', '>', or maybe '\', it cause parser error.
One of same trouble has been solved by following, but it looks like other
problem (caused by same mechanism) still remain.
GRASS in OSGEO4W, it is fix
in File menuform.py rev.43275 Line 1280
----
# parse the interface decription
self.grass_task = grassTask()
handler = processTask(self.grass_task)
enc = locale.getdefaultlocale()[1]
if enc and enc.lower() not in ("utf8", "utf-8"):
xml.sax.parseString(getInterfaceDescription(cmd[0]).decode(enc).split('\n',1)[1].replace('',
'<?xml version="1.0" encoding="utf-8"?>\n', 1).encode("utf-8"),
handler)
else:
xml.sax.parseString(getInterfaceDescription(cmd[0]),
handler)
----
Verion
GRASS 6.4.0 (2010)
Revision: 37101
Date: 2009-05-10 13:35:38 +0200 (So, 10 Mai 2009)
(Fri Oct 08 17:30:18 2010) コマンド終了 (0 sec)
----
Error Log
Traceback (most recent call last):
File "C:/GRASS__6401/etc/wxpython/wxgui.py", line 540, in
OnMenuCmd
cmd = self.GetMenuCmd(event)
File "C:/GRASS__6401/etc/wxpython/wxgui.py", line 527, in
GetMenuCmd
input =
menuform.GUI().GetCommandInputMapParamKey(cmdlist[0])
File
"C:\GRASS__6401\etc\wxpython\gui_modules\menuform.py", line
1944, in GetCommandInputMapParamKey
xml.sax.parseString(getInterfaceDescription(cmd), handler)
File "C:\OSGeo4W\apps\Python25\lib\xml\sax\__init__.py",
line 49, in parseString
parser.parse(inpsrc)
File
"C:\OSGeo4W\apps\Python25\lib\xml\sax\expatreader.py", line
107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "C:\OSGeo4W\apps\Python25\lib\xml\sax\xmlreader.py",
line 123, in parse
self.feed(buffer)
File
"C:\OSGeo4W\apps\Python25\lib\xml\sax\expatreader.py", line
211, in feed
self._err_handler.fatalError(exc)
File "C:\OSGeo4W\apps\Python25\lib\xml\sax\handler.py",
line 38, in fatalError
raise exception
xml.sax._exceptions
.
SAXParseException
:
<unknown>:1:30: unknown encoding
----
Also, when I download source file, it's encoding is ascii (Shift-JIS, for
japanese) and not UTF-8. I think source file should be in UTF-8.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1193>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list