[GRASS-dev] [GRASS GIS] #1856: wxGUI with LANG=pl_PL.utf8 throws "'ascii' codec can't decode byte"

#1856: wxGUI with LANG=pl_PL.utf8 throws "'ascii' codec can't decode byte"
--------------------------+-------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: wxGUI | Version: svn-releasebranch64
Keywords: LANG, locale | Platform: Linux
      Cpu: x86-64 |
--------------------------+-------------------------------------------------
GRASS SVN releasebranch_64 r54578.

Steps to reproduce:

1. Set your LANG to pl_PL.utf8:
{{{
$ locale | grep LANG
LANG=pl_PL.utf8
}}}

2. Run GRASS in wxGUI mode.

3. Add any vector map (eg. spearfish60/bugsites) to Map Layers.

4. Right click the vector map in Map Layers > Metadata = error:

{{{
Traceback (most recent call last):
   File "/opt/grass64-svn/etc/wxpython/gui_core/goutput.py",
line 749, in OnCmdOutput

self.cmdOutput.AddTextWrapped(message, wrap = None)
   File "/opt/grass64-svn/etc/wxpython/gui_core/goutput.py",
line 1228, in AddTextWrapped

txt = EncodeString(txt)
   File "/opt/grass64-svn/etc/wxpython/core/gcmd.py", line
103, in EncodeString

return string.encode(enc)
   File "/usr/lib/python2.7/encodings/iso8859_2.py", line 12,
in encode

return codecs.charmap_encode(input,errors,encoding_table)
UnicodeDecodeError
:
'ascii' codec can't decode byte 0xb3 in position 7: ordinal
not in range(128)
Traceback (most recent call last):
   File "/opt/grass64-svn/etc/wxpython/gui_core/goutput.py",
line 749, in OnCmdOutput

self.cmdOutput.AddTextWrapped(message, wrap = None)
   File "/opt/grass64-svn/etc/wxpython/gui_core/goutput.py",
line 1228, in AddTextWrapped

txt = EncodeString(txt)
   File "/opt/grass64-svn/etc/wxpython/core/gcmd.py", line
103, in EncodeString

return string.encode(enc)
   File "/usr/lib/python2.7/encodings/iso8859_2.py", line 12,
in encode

return codecs.charmap_encode(input,errors,encoding_table)
UnicodeDecodeError
:
'ascii' codec can't decode byte 0xf3 in position 14: ordinal
not in range(128)
(Sun Jan 20 19:46:39 2013) Polecenie zakończone (0 sec)
}}}

Python version used:

{{{
GRASS 6.4.3svn (spearfish60):~ > python --version
Python 2.7.3
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1856&gt;
GRASS GIS <http://grass.osgeo.org>

#1856: wxGUI with LANG=pl_PL.utf8 throws "'ascii' codec can't decode byte"
--------------------------+-------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: wxGUI | Version: svn-releasebranch64
Keywords: LANG, locale | Platform: Linux
      Cpu: x86-64 |
--------------------------+-------------------------------------------------
Changes (by marisn):

  * milestone: 6.4.3 => 6.4.4

Comment:

Is this still an issue?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1856#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1856: wxGUI with LANG=pl_PL.utf8 throws "'ascii' codec can't decode byte"
--------------------------+-------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: wxGUI | Version: svn-releasebranch64
Keywords: LANG, locale | Platform: Linux
      Cpu: x86-64 |
--------------------------+-------------------------------------------------

Comment(by mlennert):

Replying to [comment:1 marisn]:
> Is this still an issue?

I don't see it when calling the "Metadata", but other than that it pretty
much sounds the same as #2120.

Moritz

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1856#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1856: wxGUI with LANG=pl_PL.utf8 throws "'ascii' codec can't decode byte"
--------------------------+-------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: wxGUI | Version: svn-releasebranch64
Keywords: LANG, locale | Platform: Linux
      Cpu: x86-64 |
--------------------------+-------------------------------------------------

Comment(by hcho):

See #2120 for a solution.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1856#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1856: wxGUI with LANG=pl_PL.utf8 throws "'ascii' codec can't decode byte"
--------------------------+-------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: wxGUI | Version: svn-releasebranch64
Keywords: LANG, locale | Platform: Linux
      Cpu: x86-64 |
--------------------------+-------------------------------------------------

Comment(by hcho):

Fixed in r60307

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1856#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1856: wxGUI with LANG=pl_PL.utf8 throws "'ascii' codec can't decode byte"
--------------------------+-------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: wxGUI | Version: svn-releasebranch64
Keywords: LANG, locale | Platform: Linux
      Cpu: x86-64 |
--------------------------+-------------------------------------------------

Comment(by glynn):

Replying to [comment:4 hcho]:
> Fixed in r60307

Not a fix.

r60307 reverted.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1856#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

Can you be more specific? I think the reason for the error is that string constants are encoded in the default encoding, which is ascii, and translated messages are in the local locale. The reverted change tried to match the two encodings.

It’s not hiding any bugs in the code. In python 2, IMHO it’s not possible to change the encoding of strings without using sitecustomize.py or usercustomize.py.

If there is a better fix, that would be great because we don’t have to possibly override user’s *customize.py.

On May 18, 2014 4:05 PM, “GRASS GIS” <trac@osgeo.org> wrote:

#1856: wxGUI with LANG=pl_PL.utf8 throws “‘ascii’ codec can’t decode byte”
--------------------------±------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: wxGUI | Version: svn-releasebranch64
Keywords: LANG, locale | Platform: Linux
Cpu: x86-64 |
--------------------------±------------------------------------------------

Comment(by glynn):

Replying to [comment:4 hcho]:

Fixed in r60307

Not a fix.

r60307 reverted.


Ticket URL: <https://trac.osgeo.org/grass/ticket/1856#comment:5>
GRASS GIS <http://grass.osgeo.org>

Huidae Cho wrote:

Can you be more specific?

See my response to #2120:

https://trac.osgeo.org/grass/ticket/2120#comment:10

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