Bug report #4227

Vector layer query fails if SQL text contains not ascii characters (but works in advanced search in the table of attributes)

Added by marisn - over 13 years ago. Updated almost 13 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Vectors
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:14184

Description

Steps to reproduce:
1) Add a vector layer with attribute data in different encoding;
2) Open layer definition query dialog;
3) Enter any clause that contains non-latin letter (i.e. FOO like '%ē%').

Result - it reports 0 rows matching.
Same clause within attribute table "advanced query dialog" results in numerous results.
If dataset encoding matches current system encoding, SQL part runs fine and bug is not present.

Tested with 1.7.0 and current git.

Associated revisions

History

#1 Updated by Paolo Cavallini over 13 years ago

  • Category set to Vectors

#2 Updated by peppo - about 13 years ago

I encountered a quite similar issue. When the query on a shape layer (on windows with system encoding) contains special characters like ü the coresponding feature is not selected. When I take the the same shape file and use the "save as ..." with utf-8, the query works fine on the new layer.

I think this behaviour is problematic, because one might not notice a single feature missing and it changes the result of a query.

If anybody needs example files, I would be happy to provide them.

#3 Updated by Tim Sutton about 13 years ago

  • Target version changed from Version 1.7.1 to Version 1.7.2

#4 Updated by Giovanni Manghi about 13 years ago

  • Target version changed from Version 1.7.2 to Version 1.7.3

#5 Updated by Giovanni Manghi almost 13 years ago

  • Target version changed from Version 1.7.3 to Version 1.7.4

#6 Updated by Giovanni Manghi almost 13 years ago

  • Affected QGIS version set to master
  • Crashes QGIS or corrupts data set to No

This is still confirmed on master. You can use the vector attached to #4433 to test it.

#7 Updated by Giovanni Manghi almost 13 years ago

The problem is worst as the same issue is there even if the layer is opened with the correct encoding and the query contains non-ascii chars

example:

download this

http://www.igeo.pt/produtos/cadastro/caop/download/CAOP2011_Shapes/Cont_AAd_CAOP2011.zip

which is in iso-8859-1

then query

"Freguesia" = 'PECHÃO'

it will return 0 results

but the same query will work from the advances search in the attribute table

#8 Updated by Giovanni Manghi almost 13 years ago

  • Subject changed from Vector layer data query fails to select objects if SQL text contains not default encoding characters to Vector layer query fails if SQL text contains not ascii characters (but works in advanced search in the table of attributes)
  • Priority changed from Normal to High

tested on master

#9 Updated by Jürgen Fischer almost 13 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF