[GRASS-dev] [GRASS GIS] #2617: wxgui Raster query redirect to console UnicodeDecodeError

GRASS GIS trac at osgeo.org
Wed Mar 11 01:50:53 PDT 2015


#2617: wxgui Raster query redirect to console UnicodeDecodeError
-----------------------------+----------------------------------------------
 Reporter:  marisn           |       Owner:  grass-dev@…              
     Type:  defect           |      Status:  new                      
 Priority:  normal           |   Milestone:  7.0.1                    
Component:  wxGUI            |     Version:  svn-trunk                
 Keywords:  query, encoding  |    Platform:  MSWindows Vista          
      Cpu:  Unspecified      |  
-----------------------------+----------------------------------------------

Comment(by glynn):

 Replying to [comment:4 marisn]:

 >   In Python 2.4 the lgettext() family of functions were introduced. The
 intention of these functions is to provide an alternative which is more
 compliant with the current implementation of GNU gettext. Unlike
 '''gettext(), which returns strings encoded with the same codeset used in
 the translation file''', lgettext() will return strings encoded with the
 preferred system encoding, as returned by locale.getpreferredencoding().

 Right. Unfortunately, gettext.install() binds the _() function to the
 .gettext() method rather than to the .lgettext() method.

 Try r64834.

 >   Note that the Unicode version of the methods (i.e. ugettext() and
 ungettext()) are the recommended interface to use for internationalized
 Python programs.

 "Recommended" by someone who isn't going to be doing the (substantial)
 amount of work involved in adding all the required .encode() calls, or
 dealing with the bugs which arise whenever someone forgets the .encode()
 call. Because without those calls, unicode values will be converted using
 implicit conversions, which fails whenever the unicode value contains non-
 ASCII characters.

 As a rough guide, you can (and should) ignore anything the Python
 developers have to say about Unicode. Their attitude tends to be
 "everything should use Unicode, and the fact that POSIX (and a lot else)
 doesn't is your problem and not ours".

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



More information about the grass-dev mailing list