[GRASS-dev] Re: [GRASS GIS] #1293: Creating mapset with non-latin letter gives python ascii error

GRASS GIS trac at osgeo.org
Sat Mar 5 06:42:31 EST 2011


#1293: Creating mapset with non-latin letter gives python ascii error
-------------------------+--------------------------------------------------
 Reporter:  marisn       |       Owner:  grass-dev@…              
     Type:  defect       |      Status:  new                      
 Priority:  normal       |   Milestone:  6.4.1                    
Component:  wxGUI        |     Version:  6.4.1 RCs                
 Keywords:               |    Platform:  MSWindows Vista          
      Cpu:  Unspecified  |  
-------------------------+--------------------------------------------------

Comment(by glynn):

 Replying to [comment:4 martinl]:

 > How complicated would be to allow 8-bit characters in the
 location/mapset/map names?

 It's not particularly complicated, just a lot of work. We would have to
 audit the whole of GRASS for any issues, then fix them.

 For code which simply passes strings around within GRASS, it isn't an
 issue. It becomes an issue when code tries to interpret strings or pass
 them outside of GRASS.

 The main issue is that once you use characters outside of ASCII, encoding
 becomes an issue. Many functions (e.g. case conversions) are affected by
 the current locale. Also, if the map name is written to a file, some file
 formats require the use of specific encodings, so we would have to convert
 the text to that encoding to avoid creating invalid files. E.g. if a map
 name is in ISO-8859-* and it gets written directly to a file format which
 uses UTF-8, the result is an invalid file.

 If you stick to ASCII, none of this matters. All commonly-used encodings
 are supersets of ASCII, so conversion between ASCII and such encodings is
 a no-op. Once you move outside of ASCII you have to perform conversions,
 which means knowing which encoding you're converting to/from.

 Another significant issue is that it's unspecified whether "char" is
 signed or unsigned. Signed is more common, which can break code which
 asssumes that a char ranges from 0 to 255.

 > BTW, on Linux, I am able to create location, mapset with 8-bit
 characters, start GRASS with created mapset and display maps from this
 mapset.

 That indicates that G_legal_name() isn't being called when it should. This
 function tests for invalid characters:
 {{{
         if (*s == '/' || *s == '"' || *s == '\'' || *s <= ' ' ||
             *s == '@' || *s == ',' || *s == '=' || *s == '*' || *s > 0176)
 {
             G_warning(_("Illegal filename <%s>. Character <%c> not
 allowed.\n"), name, *s);
             return -1;
         }
 }}}

 This prohibits all 8-bit characters (due to either the "*s > 0176" or the
 "*s <= ' '", depending upon whether char is signed or unsigned).

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



More information about the grass-dev mailing list