Opened 8 years ago

Last modified 4 years ago

#1607 new defect

WXGUI regression - attribute query fails to display text attribute values

Reported by: marisn Owned by: grass-dev@…
Priority: major Milestone: 6.4.6
Component: wxGUI Version: 6.4.2
Keywords: query Cc:
CPU: Unspecified Platform: Unspecified

Description

Steps to reproduce:

  • add a vector map
  • use attribute query tool to get object attributes
  • observe an error instead of attribute value "Unable to decode value. Set encoding in GUI preferences ('Attributes')."
  • repeat the same steps in 6.4.0 and observe correct attribute data values

Both wxgui instances have no "attribute data encoding" set.

Attachments (1)

grass_encoding.zip (1.6 KB) - added by marisn 7 years ago.
Shapefile with unknown encoding

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by neteler

Do you have a sample map to test?

Changed 7 years ago by marisn

Attachment: grass_encoding.zip added

Shapefile with unknown encoding

comment:2 in reply to:  1 Changed 7 years ago by marisn

Replying to neteler:

Do you have a sample map to test?

Here You go. Just create a location and import attached file. Compare output of 6.4.0 and 6.4.x current on the same file.

The idea of setting encoding in a GUI preferences is flawed by design. I routinely deal with datasets in different encodings (map1 - utf-8; map2 - ISO-8859-13; etc.). Still this is a change that needs to be done in GRASS 7 to allow specifying encoding for each vector dataset/layer(?) separately.

comment:3 Changed 7 years ago by neteler

Keywords: query added

Yes, confirmed.

OGR can decipher it:

ogrinfo grass_encoding.shp grass_encoding
INFO: Open of `grass_encoding.shp'
      using driver `ESRI Shapefile' successful.

Layer name: grass_encoding
Geometry: Point
Feature Count: 2
Extent: (490813.154373, 280495.272002) - (516942.353107, 284572.168258)
Layer SRS WKT:
PROJCS["LKS92_Latvia_TM",
    GEOGCS["GCS_LKS92",
        DATUM["Latvia_1992",
            SPHEROID["GRS_1980",6378137,298.257222101]],
        PRIMEM["Greenwich",0],
        UNIT["Degree",0.017453292519943295]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",24],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",-6000000],
    UNIT["Meter",1]]
id: Integer (10.0)
nosaukums: String (80.0)
OGRFeature(grass_encoding):0
  id (Integer) = (null)
  nosaukums (String) = âðòï
  POINT (490813.154373089957517 284572.168258102843538)

OGRFeature(grass_encoding):1
  id (Integer) = (null)
  nosaukums (String) = çèþì
  POINT (516942.35310710943304 280495.272001731034834)

while GRASS' wxGUI query tool cannot giving the indicated error.

Also the Tcl/TK form fails: "nosaukums : âðòï "

comment:4 in reply to:  3 Changed 7 years ago by marisn

Replying to neteler:

Yes, confirmed.

while GRASS' wxGUI query tool cannot giving the indicated error.

Also the Tcl/TK form fails: "nosaukums : âðòï "

Well - OGR just passes raw string trough. It's not correct, still for a latin letters based text it will work just fine. I made a bad example, as I should be using example "Rîga", which is incorrect, still for anyone in Latvia it would be clear that it should be "Rīga". GRASS 6.4.0 was just passing-through any attribute data and thus ignored any coding issues. Changes in 6.4.x introduced (broken by design) recoding of values and thus instead of just seeing broken string, that might be meaningful enough to be fine, now it displays error message. Saying "just set correct encoding in blahblah" for non-technical users equals "no attributes for You!". Why it's broken? Try to set encoding in preferences to datasets encoding: "CP-1257"

Settings applied to current session but not saved                               
Traceback (most recent call last):
  File "/home/maris/soft/grass_64/dist.x86_64-unknown-linux-
gnu/etc/wxpython/lmgr/frame.py", line 1355, in
OnShowAttributeTable

selection = selection)
  File "/home/maris/soft/grass_64/dist.x86_64-unknown-linux-
gnu/etc/wxpython/dbmgr/manager.py", line 641, in __init__

self._createBrowsePage()
  File "/home/maris/soft/grass_64/dist.x86_64-unknown-linux-
gnu/etc/wxpython/dbmgr/manager.py", line 688, in
_createBrowsePage

self.mapDBInfo, layer)
  File "/home/maris/soft/grass_64/dist.x86_64-unknown-linux-
gnu/etc/wxpython/dbmgr/manager.py", line 93, in __init__

keyColumn = self.LoadData(layer)
  File "/home/maris/soft/grass_64/dist.x86_64-unknown-linux-
gnu/etc/wxpython/dbmgr/manager.py", line 246, in LoadData

self.AddDataRow(i, record, columns, keyId)
  File "/home/maris/soft/grass_64/dist.x86_64-unknown-linux-
gnu/etc/wxpython/dbmgr/manager.py", line 295, in AddDataRow

self.itemDataMap[i].append(unicodeValue(value))
  File "/home/maris/soft/grass_64/dist.x86_64-unknown-linux-
gnu/etc/wxpython/dbmgr/vinfo.py", line 35, in unicodeValue

value = unicode(value, enc)
LookupError
:
unknown encoding: CP-1257

comment:5 Changed 6 years ago by neteler

Milestone: 6.4.36.4.4

(see also Ticket #1609)

comment:6 Changed 4 years ago by neteler

Milestone: 6.4.46.4.6
Note: See TracTickets for help on using tickets.