[GRASS-dev] [GRASS GIS] #1330: wxGUI: "UnicodeEncodeError: 'ascii' codec can't encode characters" in pl_PL.UTF-8

#1330: wxGUI: "UnicodeEncodeError: 'ascii' codec can't encode characters" in
pl_PL.UTF-8
----------------------+-----------------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: wxGUI | Version: svn-releasebranch64
Keywords: | Platform: Linux
      Cpu: All |
----------------------+-----------------------------------------------------
Debian squeeze amd64, releasebranch_6_4 r45717.

1. Start wxGUI in pl_PL.UTF-8.
2. Add any raster or vector layer.
3. Change it's opacity level.

Try to save a project - error:

{{{
Zapis bieżących ustawień do pliku projektu nie powiódł się.

Powód: 'ascii' codec can't encode characters in position 66-67: ordinal
not in range(128)

Traceback (most recent call last):
   File "/usr/local/grass-6.4.1svn/etc/wxpython/wxgui.py", line 844, in
SaveToWorkspaceFile
     workspace.WriteWorkspaceFile(lmgr = self, file = tmpfile)
   File "/usr/local/grass-6.4.1svn/etc/wxpython/gui_modules/workspace.py",
line 734, in __init__
     self.__writeLayer(mapTree, item)
   File "/usr/local/grass-6.4.1svn/etc/wxpython/gui_modules/workspace.py",
line 781, in __writeLayer
     (' ' * self.indent, type, name, checked, opacity));
UnicodeEncodeError: 'ascii' codec can't encode characters in position
66-67: ordinal not in range(128)
}}}

Can't also remove the problematic layer from the list - similar error:

{{{
Traceback (most recent call last):
   File "/usr/local/grass-6.4.1svn/etc/wxpython/wxgui.py",
line 1395, in OnDeleteLayer

name = str(self.curr_page.maptree.GetItemText(item))
UnicodeEncodeError
:
'ascii' codec can't encode characters in position 31-32:
ordinal not in range(128)
}}}

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

#1330: wxGUI: "UnicodeEncodeError: 'ascii' codec can't encode characters" in
pl_PL.UTF-8
----------------------+-----------------------------------------------------
Reporter: msieczka | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.4.2
Component: wxGUI | Version: svn-releasebranch64
Keywords: ascii | Platform: Linux
      Cpu: All |
----------------------+-----------------------------------------------------
Changes (by martinl):

* cc: grass-dev@… (added)
  * keywords: => ascii
  * status: new => assigned
  * owner: grass-dev@… => martinl
  * milestone: 6.4.1 => 6.4.2

Comment:

Please try out GRASS 6.5, should be working there. Changing milestone to
6.4.2. Name of raster/vector contains only ASCII characters?

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

#1330: wxGUI: "UnicodeEncodeError: 'ascii' codec can't encode characters" in
pl_PL.UTF-8
----------------------+-----------------------------------------------------
Reporter: msieczka | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.4.2
Component: wxGUI | Version: svn-releasebranch64
Keywords: ascii | Platform: Linux
      Cpu: All |
----------------------+-----------------------------------------------------

Comment(by msieczka):

Replying to [comment:1 martinl]:
> Please try out GRASS 6.5, should be working there.

Doesn't work in 6.5 r45717 either:

{{{
Zapis bieżących ustawień do pliku projektu nie powiódł się.

Powód: 'ascii' codec can't encode characters in position 66-67: ordinal
not in range(128)

Traceback (most recent call last):
   File "/usr/local/grass-6.5.svn/etc/wxpython/wxgui.py", line 918, in
SaveToWorkspaceFile
     workspace.WriteWorkspaceFile(lmgr = self, file = tmpfile)
   File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/workspace.py",
line 734, in __init__
     self.__writeLayer(mapTree, item)
   File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/workspace.py",
line 781, in __writeLayer
     (' ' * self.indent, type, name, checked, opacity));
UnicodeEncodeError: 'ascii' codec can't encode characters in position
66-67: ordinal not in range(128)
}}}

> Changing milestone to 6.4.2.

6.4.1 impossible?

> Name of raster/vector contains only ASCII characters?

Yes. The culprit seems to be the Polish word for "opacity" -
"nieprzeźroczystość", which wxGUI has problem to deal with.

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

#1330: wxGUI: "UnicodeEncodeError: 'ascii' codec can't encode characters" in
pl_PL.UTF-8
----------------------+-----------------------------------------------------
Reporter: msieczka | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.4.2
Component: wxGUI | Version: svn-releasebranch64
Keywords: ascii | Platform: Linux
      Cpu: All |
----------------------+-----------------------------------------------------

Comment(by martinl):

Replying to [comment:2 msieczka]:
> Replying to [comment:1 martinl]:
> > Please try out GRASS 6.5, should be working there.

> Doesn't work in 6.5 r45717 either:

Testing G65 with polish locale, "opacity" not translated, no errors.

> > Changing milestone to 6.4.2.

> 6.4.1 impossible?

Yes, too late. For 6.4.2 I am planning major update of wxGUI (from
devbr6).

Martin

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

GRASS GIS wrote:

> Name of raster/vector contains only ASCII characters?

Yes. The culprit seems to be the Polish word for "opacity" -
"nieprzeźroczystość", which wxGUI has problem to deal with.

I do not have any accented characters in file/directory names, use UTF8
czech encoding and I do get this error when trying to save the workspace
.grc file (GRASS 7.0). Apart of alphanumeric characters, my maps contain
only '-' and '_' characters.

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/GRASS-GIS-1330-wxGUI-UnicodeEncodeError-ascii-codec-can-t-encode-characters-in-pl-PL-UTF-8-tp6189279p6490658.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

The problem to save workspace file is the same in GRASS 6.4.1,
LANG=cs_CZ.utf8.
When grass64 or grass70 started with LANG=C, no errors. WAIT: after that,
trying it again with my normal LANG=cs_CZ.utf8 setting (starting with just
grass64 or grass70 commad), no error anymore! Seems like by temporary using
LANG=C, something "initilalized" properly, and the problem is gone. I will
try to reproduce that on my other machine and also look, if the "fix"
persists after reboot (tomorow).
Below is copy of text of error message window popping up after the first
attempt to save the workspace in 6.4.1. In GRASS 7.0 similar error message
appeared in the terminal. I also observed similar error in 7.0 when trying
to add an action in WxGui modeller (but not in 6.4.1).
Might be also of interest:
I'm running 64bit Debian wheezy based Linux Mint.
GRASS 6.4.1 comes from debian binary package.
GRASS 7.0 was compiled from svn few days ago (ver. 7.0.svn46654).

*** the error message: ****
Zápis aktuálního nastavení do souboru pracovní oblasti selhalo.

Důvod: 'ascii' codec can't encode character u'\u016f' in position 77:
ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/lib/grass64/etc/wxpython/wxgui.py", line 844, in
SaveToWorkspaceFile
    workspace.WriteWorkspaceFile(lmgr = self, file = tmpfile)
  File "/usr/lib/grass64/etc/wxpython/gui_modules/workspace.py", line 734,
in __init__
    self.__writeLayer(mapTree, item)
  File "/usr/lib/grass64/etc/wxpython/gui_modules/workspace.py", line 781,
in __writeLayer
    (' ' * self.indent, type, name, checked, opacity));
UnicodeEncodeError: 'ascii' codec can't encode character u'\u016f' in
position 77: ordinal not in range(128)

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/GRASS-GIS-1330-wxGUI-UnicodeEncodeError-ascii-codec-can-t-encode-characters-in-pl-PL-UTF-8-tp6189279p6494039.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Tomas_IV wrote:

When grass64 or grass70 started with LANG=C, no errors. WAIT: after that,
trying it again with my normal LANG=cs_CZ.utf8 setting (starting with just
grass64 or grass70 commad), no error anymore! ........
I will try to reproduce that on my other machine and also look, if the
"fix" persists after reboot (tomorow).

OK, so I did a few tests on my notebook, all in GRASS 6.4.1. Every session
has these steps:
* start GRASS with a locale (LANG=something /usr/bin/grass)
* open a mapset (same in all tests)
* load a raster or two into map view
* try to save the .grc file

Instead of the LANG=C I used LANG=en_US.utf8, which also works (more on that
later).

The tests:
1) GRASS with my default cs_CZ.utf8 locale: Saving .grc file *fails*.
2) GRASS with en_US.utf8 locale: Saving .grc OK.
3) GRASS with my default cs_CZ.utf8 locale: Saving .grc file OK.
4) Reboot
5) GRASS with my default cs_CZ.utf8 locale: Saving .grc file OK.
So it really seems that temporarly using English cures the problem.

In the meantime I also observed (but it was in GRASS 7) that with LANG=C
there are problems with '@'character in names of layers (layer@mapset).
That's why I use rather en_US.utf8 in these tests

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/GRASS-GIS-1330-wxGUI-UnicodeEncodeError-ascii-codec-can-t-encode-characters-in-pl-PL-UTF-8-tp6189279p6510087.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Hi,

2011/6/23 Tomas_IV <brunclik@atlas.cz>:

OK, so I did a few tests on my notebook, all in GRASS 6.4.1. Every session
has these steps:
* start GRASS with a locale (LANG=something /usr/bin/grass)
* open a mapset (same in all tests)
* load a raster or two into map view

are you also changing opacity level at this point?

* try to save the .grc file

I guess you mean gxw file

Martin

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

2011/6/23 Martin Landa <landa.martin@gmail.com>:

* load a raster or two into map view

are you also changing opacity level at this point?

or renaming the map layer (using non-ascii characters).

There is a bug in all version of GRASS, I will look on it.

Martin

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

#1330: wxGUI: "UnicodeEncodeError: 'ascii' codec can't encode characters" in
pl_PL.UTF-8
----------------------+-----------------------------------------------------
Reporter: msieczka | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.4.2
Component: wxGUI | Version: svn-releasebranch64
Keywords: ascii | Platform: Linux
      Cpu: All |
----------------------+-----------------------------------------------------

Comment(by martinl):

Please try out r46771 (backported also to devbr6 and relbr64)

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

Hi,

2011/6/23 Tomas_IV <brunclik@atlas.cz>:

OK, so I did a few tests on my notebook, all in GRASS 6.4.1. Every session
has these steps:

please try out 6.4.2 (r46773).

Martin

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

Martin Landa wrote:

are you also changing opacity level at this point?

or renaming the map layer (using non-ascii characters).

I did not change the opacity AFAIK, but yes, there somehow appeared the
(průhlednost 100%) note in the list of layers and that was the cause (in
english there is (opacity 100%)).
BTW the word "průhlednost" is wrong translation, there shoud be
"neprůhlednost".

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/GRASS-GIS-1330-wxGUI-UnicodeEncodeError-ascii-codec-can-t-encode-characters-in-pl-PL-UTF-8-tp6189279p6511786.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

#1330: wxGUI: "UnicodeEncodeError: 'ascii' codec can't encode characters" in
pl_PL.UTF-8
-----------------------+----------------------------------------------------
  Reporter: msieczka | Owner: martinl
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.2
Component: wxGUI | Version: svn-releasebranch64
Resolution: fixed | Keywords: ascii
  Platform: Linux | Cpu: All
-----------------------+----------------------------------------------------
Changes (by martinl):

  * status: assigned => closed
  * resolution: => fixed

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