[GRASS-dev] WinGRASS and non-latin letters

Maris Nartiss maris.gis at gmail.com
Sat Mar 19 06:14:04 EDT 2011


Hello,
You are overlooking issues coming from current GRASS architecture. We
have CLI+GUI mixture and thus have to deal with both codepages at same
time. Also GRASS has to relay on other components working fine too
(GDAL/OGR).

I wrote a small test example for wish GUI.
Requirements to run:
Rename file_check_code to .zip file and extract it's contents (GMail
doesn't allow to send executable files)
WinGRASS-6.4.SVN-r45713-1-Setup.exe
All system locale settings set to some non-latin locale (Latvian,
Russian would do)
GRASS installed into C:\Program Files\GRASS 6.4.SVN (fix paths in
files if it differs)
A username with non-latin letter (Māris is a nice one ;)
Some shapefile in Your users home directory.
Extract attached files to users home directory and run kodejums.bat from CMD.exe
When test asks for file, point it to shapefile

I'm also attaching output of code run on my Vista machine. One is run
with username Māris and second one - test.

Glynn, if You have an idea how to fix my example code, we could track
down all similar use patterns in gis.m etc. and fix them.

Somebody with better wxPython-fu could write similar testing code I
could run and provide it's results.


Maris.


2011/3/19 Glynn Clements <glynn at gclements.plus.com>:
>
> Maris Nartiss wrote:
>
>> The root of the problem: CMD (and thus also .bat files) use OEM
>> encoding, GUI applications use ANSI encoding.
>
> The console functions (WriteConsole etc) use the OEM encoding.
> Everything else uses ANSI encoding. In particular, the argv parameter
> passed to main uses ANSI encoding. This is true for both "console" and
> "GUI" programs.
>
> AFAICT, the only situation where the OEM encoding will make its way
> into GRASS is via curses.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
C:\Users\Mâris>kodejums.bat
Active code page: 775
HOME=C:\Users\Mâris
C:\Users\Mâris exists
GISRC=C:/Users/MÔris
C:/Users/MÔris doesnt exist

WISH ENCODING: cp1257
HOME : C:\Users\Mâris
GISRC: C:/Users/MÔris
HOME  TCL EXISTS: 1
GISRC TCL EXISTS: 0
FILE EXISTS.bat: HOME  file C:\Users\Mƒris exists for .bat
FILE EXISTS.bat: GISRC no file named C:/Users/Mâris for .bat
CHOOSEN FILE EXISTS TLC: 1
CHOOSEN FILE EXISTS via FILE.bat: file C:/Users/Mƒris/Documents/GISLatvija/ainavzemes_poly.shp exists for .bat
CHOOSEN FILE EXISTS via nativename FILE.bat: file C:\Users\Mƒris\Documents\GISLatvija\ainavzemes_poly.shp exists for .bat
CHOOSEN FILE EXISTS via ogr.bat: ERROR: OGR testing C:/Users/Mƒris/Documents/GISLatvija/ainavzemes_poly.shp ainavzemes_poly 
FAILURE:
Unable to open datasource `C:/Users/Mâris/Documents/GISLatvija/ainavzemes_poly.shp' with the following drivers.
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> SDTS
  -> TIGER
  -> S57
  -> DGN
  -> VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> NAS
  -> GML
  -> GPX
  -> KML
  -> GeoJSON
  -> Interlis 1
  -> Interlis 2
  -> GMT
  -> SQLite
  -> ODBC
  -> PGeo
  -> MSSQLSpatial
  -> OGDI
  -> PostgreSQL
  -> MySQL
  -> PCIDSK
  -> XPlane
  -> AVCBin
  -> AVCE00
  -> DXF
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> PGDump
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> PDS
  -> WFS
  -> HTF
  -> AeronavFAA
child process exited abnormally 

CHOOSEN FILE EXISTS via nativename ogr.bat: ERROR: OGR testing C:\Users\Mƒris\Documents\GISLatvija\ainavzemes_poly.shp ainavzemes_poly 
FAILURE:
Unable to open datasource `C:\Users\Mâris\Documents\GISLatvija\ainavzemes_poly.shp' with the following drivers.
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> SDTS
  -> TIGER
  -> S57
  -> DGN
  -> VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> NAS
  -> GML
  -> GPX
  -> KML
  -> GeoJSON
  -> Interlis 1
  -> Interlis 2
  -> GMT
  -> SQLite
  -> ODBC
  -> PGeo
  -> MSSQLSpatial
  -> OGDI
  -> PostgreSQL
  -> MySQL
  -> PCIDSK
  -> XPlane
  -> AVCBin
  -> AVCE00
  -> DXF
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> PGDump
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> PDS
  -> WFS
  -> HTF
  -> AeronavFAA
child process exited abnormally 

OGRINFO TCL: C:/Program Files/GRASS 6.4.SVN/extrabin/ogrinfo.exe -ro -so C:/Users/Mâris/Documents/GISLatvija/ainavzemes_poly.shp 
ERROR: FAILURE:
Unable to open datasource `C:/Users/Mâris/Documents/GISLatvija/ainavzemes_poly.shp' with the following drivers.
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> SDTS
  -> TIGER
  -> S57
  -> DGN
  -> VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> NAS
  -> GML
  -> GPX
  -> KML
  -> GeoJSON
  -> Interlis 1
  -> Interlis 2
  -> GMT
  -> SQLite
  -> ODBC
  -> PGeo
  -> MSSQLSpatial
  -> OGDI
  -> PostgreSQL
  -> MySQL
  -> PCIDSK
  -> XPlane
  -> AVCBin
  -> AVCE00
  -> DXF
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> PGDump
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> PDS
  -> WFS
  -> HTF
  -> AeronavFAA
child process exited abnormally 

OGRINFO NATIVE: C:/Program Files/GRASS 6.4.SVN/extrabin/ogrinfo.exe -ro -so C:\Users\Mâris\Documents\GISLatvija\ainavzemes_poly.shp 
ERROR: FAILURE:
Unable to open datasource `C:\Users\Mâris\Documents\GISLatvija\ainavzemes_poly.shp' with the following drivers.
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> SDTS
  -> TIGER
  -> S57
  -> DGN
  -> VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> NAS
  -> GML
  -> GPX
  -> KML
  -> GeoJSON
  -> Interlis 1
  -> Interlis 2
  -> GMT
  -> SQLite
  -> ODBC
  -> PGeo
  -> MSSQLSpatial
  -> OGDI
  -> PostgreSQL
  -> MySQL
  -> PCIDSK
  -> XPlane
  -> AVCBin
  -> AVCE00
  -> DXF
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> PGDump
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> PDS
  -> WFS
  -> HTF
  -> AeronavFAA
child process exited abnormally 

Testing complete

-------------- next part --------------
C:\Users\tests>kodejums.bat
Active code page: 775
HOME=C:\Users\tests
C:\Users\tests exists
GISRC=C:/Users/tests
C:/Users/tests exists

WISH ENCODING: cp1257
HOME : C:\Users\tests
GISRC: C:/Users/tests
HOME  TCL EXISTS: 1
GISRC TCL EXISTS: 1
FILE EXISTS.bat: HOME  file C:\Users\tests exists for .bat
FILE EXISTS.bat: GISRC file C:/Users/tests exists for .bat
CHOOSEN FILE EXISTS TLC: 1
CHOOSEN FILE EXISTS via FILE.bat: file C:/Users/tests/Documents/GISLatvija/ainavzemes_poly.shp exists for .bat
CHOOSEN FILE EXISTS via nativename FILE.bat: file C:\Users\tests\Documents\GISLatvija\ainavzemes_poly.shp exists for .bat
CHOOSEN FILE EXISTS via ogr.bat: OUT: OGR testing C:/Users/tests/Documents/GISLatvija/ainavzemes_poly.shp ainavzemes_poly 
INFO: Open of `C:/Users/tests/Documents/GISLatvija/ainavzemes_poly.shp'
      using driver `ESRI Shapefile' successful.

Layer name: ainavzemes_poly
Geometry: Polygon
Feature Count: 15
Extent: (312943.499241, 6172854.436423) - (762513.875340, 6438879.999806)
Layer SRS WKT:
PROJCS["GRS_1980_Transverse_Mercator",
    GEOGCS["GCS_GRS_1980",
        DATUM["GRS_1980",
            SPHEROID["GRS_1980",6378137.0,298.257222101]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["False_Easting",500000.0],
    PARAMETER["False_Northing",0.0],
    PARAMETER["Central_Meridian",24.0],
    PARAMETER["Scale_Factor",0.9996],
    PARAMETER["Latitude_Of_Origin",0.0],
    UNIT["Meter",1.0]]
NOSAUKUMS: String (50.0)
Shape_Leng: Real (19.11)
Shape_Area: Real (19.11) 
ERROR: OGR testing C:/Users/tests/Documents/GISLatvija/ainavzemes_poly.shp ainavzemes_poly 
INFO: Open of `C:/Users/tests/Documents/GISLatvija/ainavzemes_poly.shp'
      using driver `ESRI Shapefile' successful.

Layer name: ainavzemes_poly
Geometry: Polygon
Feature Count: 15
Extent: (312943.499241, 6172854.436423) - (762513.875340, 6438879.999806)
Layer SRS WKT:
PROJCS["GRS_1980_Transverse_Mercator",
    GEOGCS["GCS_GRS_1980",
        DATUM["GRS_1980",
            SPHEROID["GRS_1980",6378137.0,298.257222101]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["False_Easting",500000.0],
    PARAMETER["False_Northing",0.0],
    PARAMETER["Central_Meridian",24.0],
    PARAMETER["Scale_Factor",0.9996],
    PARAMETER["Latitude_Of_Origin",0.0],
    UNIT["Meter",1.0]]
NOSAUKUMS: String (50.0)
Shape_Leng: Real (19.11)
Shape_Area: Real (19.11) 

CHOOSEN FILE EXISTS via nativename ogr.bat: OUT: OGR testing C:\Users\tests\Documents\GISLatvija\ainavzemes_poly.shp ainavzemes_poly 
INFO: Open of `C:\Users\tests\Documents\GISLatvija\ainavzemes_poly.shp'
      using driver `ESRI Shapefile' successful.

Layer name: ainavzemes_poly
Geometry: Polygon
Feature Count: 15
Extent: (312943.499241, 6172854.436423) - (762513.875340, 6438879.999806)
Layer SRS WKT:
PROJCS["GRS_1980_Transverse_Mercator",
    GEOGCS["GCS_GRS_1980",
        DATUM["GRS_1980",
            SPHEROID["GRS_1980",6378137.0,298.257222101]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["False_Easting",500000.0],
    PARAMETER["False_Northing",0.0],
    PARAMETER["Central_Meridian",24.0],
    PARAMETER["Scale_Factor",0.9996],
    PARAMETER["Latitude_Of_Origin",0.0],
    UNIT["Meter",1.0]]
NOSAUKUMS: String (50.0)
Shape_Leng: Real (19.11)
Shape_Area: Real (19.11) 
ERROR: OGR testing C:\Users\tests\Documents\GISLatvija\ainavzemes_poly.shp ainavzemes_poly 
INFO: Open of `C:\Users\tests\Documents\GISLatvija\ainavzemes_poly.shp'
      using driver `ESRI Shapefile' successful.

Layer name: ainavzemes_poly
Geometry: Polygon
Feature Count: 15
Extent: (312943.499241, 6172854.436423) - (762513.875340, 6438879.999806)
Layer SRS WKT:
PROJCS["GRS_1980_Transverse_Mercator",
    GEOGCS["GCS_GRS_1980",
        DATUM["GRS_1980",
            SPHEROID["GRS_1980",6378137.0,298.257222101]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["False_Easting",500000.0],
    PARAMETER["False_Northing",0.0],
    PARAMETER["Central_Meridian",24.0],
    PARAMETER["Scale_Factor",0.9996],
    PARAMETER["Latitude_Of_Origin",0.0],
    UNIT["Meter",1.0]]
NOSAUKUMS: String (50.0)
Shape_Leng: Real (19.11)
Shape_Area: Real (19.11) 

OGRINFO TCL: C:/Program Files/GRASS 6.4.SVN/extrabin/ogrinfo.exe -ro -so C:/Users/tests/Documents/GISLatvija/ainavzemes_poly.shp 
OUT: INFO: Open of `C:/Users/tests/Documents/GISLatvija/ainavzemes_poly.shp'
      using driver `ESRI Shapefile' successful.
1: ainavzemes_poly (Polygon) 
ERROR: INFO: Open of `C:/Users/tests/Documents/GISLatvija/ainavzemes_poly.shp'
      using driver `ESRI Shapefile' successful.
1: ainavzemes_poly (Polygon) 

OGRINFO NATIVE: C:/Program Files/GRASS 6.4.SVN/extrabin/ogrinfo.exe -ro -so C:\Users\tests\Documents\GISLatvija\ainavzemes_poly.shp 
OUT: INFO: Open of `C:\Users\tests\Documents\GISLatvija\ainavzemes_poly.shp'
      using driver `ESRI Shapefile' successful.
1: ainavzemes_poly (Polygon) 
ERROR: INFO: Open of `C:\Users\tests\Documents\GISLatvija\ainavzemes_poly.shp'
      using driver `ESRI Shapefile' successful.
1: ainavzemes_poly (Polygon) 

Testing complete

-------------- next part --------------
A non-text attachment was scrubbed...
Name: file_check_code
Type: application/octet-stream
Size: 1749 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20110319/af65e15b/file_check_code-0001.obj


More information about the grass-dev mailing list