[GRASS-dev] [GRASS GIS] #3389: g.gui: UnicodeEncodeError when writing a workspace file including non-ASCII characters

#3389: g.gui: UnicodeEncodeError when writing a workspace file including non-ASCII
characters
--------------------+-------------------------
Reporter: lrntct | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.2.2
Component: wxGUI | Version: 7.2.0
Keywords: | CPU: Unspecified
Platform: Linux |
--------------------+-------------------------
I've a workspace with two vector files. Saving it worked fine until I
added a non-ASCII character in a WHERE field:

{{{
d.vect map=Localidades_Urbanas_Estudio@PERMANENT where="b_Municipio IN
('Saltillo', 'Río Bravo')" width=1
}}}

The display function works correctly, but when I try to save the
workspace, I receive the following error:

{{{
Writing current settings to workspace file failed.

Reason: 'ascii' codec can't encode character u'\xed' in position 57:
ordinal not in range(128)

Traceback (most recent call last):
   File "/usr/lib/grass72/gui/wxpython/lmgr/frame.py", line 1634, in
SaveToWorkspaceFile
     WriteWorkspaceFile(lmgr=self, file=tmpfile)
   File "/usr/lib/grass72/gui/wxpython/core/workspace.py", line 894, in
__init__
     self.__writeLayer(mapTree, item)
   File "/usr/lib/grass72/gui/wxpython/core/workspace.py", line 987, in
__writeLayer
     (' ' * self.indent, self.__filterValue(val)))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in
position 57: ordinal not in range(128)
}}}

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

#3389: g.gui: UnicodeEncodeError when writing a workspace file including non-ASCII
characters
--------------------------+-------------------------
  Reporter: lrntct | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: wxGUI | Version: 7.2.0
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------

Comment (by hellik):

Replying to [ticket:3389 lrntct]:
> I've a workspace with two vector files. Saving it worked fine until I
added a non-ASCII character in a WHERE field:
>
>
> {{{
> d.vect map=Localidades_Urbanas_Estudio@PERMANENT where="b_Municipio IN
('Saltillo', 'Río Bravo')" width=1
> }}}
>
> The display function works correctly, but when I try to save the
workspace, I receive the following error:
>
> {{{
> Writing current settings to workspace file failed.
>
> Reason: 'ascii' codec can't encode character u'\xed' in position 57:
ordinal not in range(128)
>
> Traceback (most recent call last):
> File "/usr/lib/grass72/gui/wxpython/lmgr/frame.py", line 1634, in
SaveToWorkspaceFile
> WriteWorkspaceFile(lmgr=self, file=tmpfile)
> File "/usr/lib/grass72/gui/wxpython/core/workspace.py", line 894, in
__init__
> self.__writeLayer(mapTree, item)
> File "/usr/lib/grass72/gui/wxpython/core/workspace.py", line 987, in
__writeLayer
> (' ' * self.indent, self.__filterValue(val)))
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in
position 57: ordinal not in range(128)
> }}}
>
>
>

some related tickets:

#3340, #3275, #3219, #3205, #3126

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

#3389: g.gui: UnicodeEncodeError when writing a workspace file including non-ASCII
characters
--------------------------+-------------------------
  Reporter: lrntct | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: wxGUI | Version: 7.2.0
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------

Comment (by hellik):

Replying to [ticket:3389 lrntct]:
> I've a workspace with two vector files. Saving it worked fine until I
added a non-ASCII character in a WHERE field:

which grass version are you using?

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

#3389: g.gui: UnicodeEncodeError when writing a workspace file including non-ASCII
characters
--------------------------+-------------------------
  Reporter: lrntct | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: wxGUI | Version: 7.2.0
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------

Comment (by lrntct):

Replying to [comment:2 hellik]:
> Replying to [ticket:3389 lrntct]:
> > I've a workspace with two vector files. Saving it worked fine until I
added a non-ASCII character in a WHERE field:
>
> which grass version are you using?

I'm using 7.2.0

Indeed #3275 and #3340 seems related (if not equal).
I searched for keywords before filling the ticket, but did not find them
because the message is in French in those.

If I understand well, this issue should be fixed in 7.2.2 ?

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

#3389: g.gui: UnicodeEncodeError when writing a workspace file including non-ASCII
characters
--------------------------+-------------------------
  Reporter: lrntct | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: wxGUI | Version: 7.2.0
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------

Comment (by hellik):

Replying to [comment:3 lrntct]:
> Replying to [comment:2 hellik]:
> > Replying to [ticket:3389 lrntct]:
> > > I've a workspace with two vector files. Saving it worked fine until
I added a non-ASCII character in a WHERE field:
> >
> > which grass version are you using?
>
> I'm using 7.2.0
>
> Indeed #3275 and #3340 seems related (if not equal).
> I searched for keywords before filling the ticket, but did not find them
because the message is in French in those.
>
> If I understand well, this issue should be fixed in 7.2.2 ?

according to the tickets yes. testing the newer version very welcome.

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

#3389: g.gui: UnicodeEncodeError when writing a workspace file including non-ASCII
characters
--------------------------+--------------------------------
  Reporter: lrntct | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: wxGUI | Version: 7.2.0
Resolution: fixed | Keywords: workspace, unicode
       CPU: Unspecified | Platform: Linux
--------------------------+--------------------------------
Changes (by wenzeslaus):

* status: new => closed
* keywords: => workspace, unicode
* resolution: => fixed

Comment:

Fixed (in 7.2.2 according to comment:4, tested with trunk now).

Note: There seems to be different problem: The where statement does not
show in the dialog of loaded workspace but it was applied and in status
bar you can see it was loaded correctly. Leaving that for further
confirmation and different ticket if needed.

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

#3389: g.gui: UnicodeEncodeError when writing a workspace file including non-ASCII
characters
--------------------------+--------------------------------
  Reporter: lrntct | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: wxGUI | Version: 7.2.0
Resolution: fixed | Keywords: workspace, unicode
       CPU: Unspecified | Platform: Linux
--------------------------+--------------------------------

Comment (by neteler):

Replying to [comment:8 wenzeslaus]:
> Fixed (in 7.2.2 according to comment:4, tested with trunk now).
>
> Note: There seems to be different problem: The where statement ...

Please open a different ticket for a new problem.

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