[GRASS-dev] Re: [GRASS-SVN] r46343 - grass/trunk/lib/python

Glynn Clements glynn at gclements.plus.com
Mon Jul 4 16:50:29 EDT 2011


Martin Landa wrote:

> > Author: glynn
> > Date: 2011-05-21 06:51:24 -0700 (Sat, 21 May 2011)
> > New Revision: 46343
> >
> > Modified:
> >   grass/trunk/lib/python/core.py
> > Log:
> > Don't try to decode process output
> 
> can you elaborate a bit? Thanks in advance.

The output from and input to GRASS commands consists of bytes, not
characters.

Decoding (and subsequent re-encoding) creates a risk of (pointless)
conversion failures if commands produce output which isn't compatible
with the locale's encoding (which is quite possible; with a few
exceptions, GRASS libraries and modules deal with bytes, not
characters).

If wxGUI wants (unicode) character strings, wxGUI should perform the
decoding. In general, if the data is being passed to wxWidgets, it
should be decoded. If it's being passed to a command or written to a
file, the raw byte sequences should normally be passed through
untouched.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list