[GRASS-dev] [GRASS GIS] #2617: wxgui Raster query redirect to console UnicodeDecodeError
GRASS GIS
trac at osgeo.org
Thu Mar 12 01:23:01 PDT 2015
#2617: wxgui Raster query redirect to console UnicodeDecodeError
----------------------------------------------+-----------------------------
Reporter: marisn | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.1
Component: wxGUI | Version: svn-trunk
Keywords: query, encoding, python, gettext | Platform: MSWindows Vista
Cpu: Unspecified |
----------------------------------------------+-----------------------------
Comment(by glynn):
Replying to [comment:6 zarch]:
> We have to do this work in any case for python3.
If we actually use it. For most scripting tasks, Python 3 offers nothing
but inconvenience.
And even then, there's a much simpler way to deal with it: convert unicode
strings to byte strings at the point they arise (there are far fewer of
these compared to the number of places where we will need to write byte
strings to streams or pass them as command arguments).
> We can create a function that explicity convert every input to unicode,
something like:
But why bother? At the lowest level, scripts tend to do two things: invoke
commands and read/write streams. Both of these deal with byte strings.
Converting to unicode then back again just creates unnecessary failure
modes; there's no guarantee that data read from a given stream will be in
the locale's encoding, or even in any known encoding.
wxGUI has to deal with this because wxPython uses Unicode throughout (and
look how many wxGUI issues relate to Unicode{Encode,Decode}Error as a
result). The scripting library doesn't need to deal with this; there's no
inherent reason why most scripts should ever encounter a unicode value.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2617#comment:8>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list