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

Hi,

2011/5/21 <svn_grass@osgeo.org>:

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. Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

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@gclements.plus.com>

On Mon, Jul 4, 2011 at 10:50 PM, Glynn Clements
<glynn@gclements.plus.com> wrote:

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.

AFAIK this is not yet backported, should it be?

Markus

Markus Neteler 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

AFAIK this is not yet backported, should it be?

r46343 reverts r45544; if that was back-ported, so should this.

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

Hi,

2011/7/23 Glynn Clements <glynn@gclements.plus.com>:

r46343 reverts r45544; if that was back-ported, so should this.

right, done in r47230 and r47231.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa