gvSIG bugs #984
WFS: Bad encoding for requests with Filter set
Status: | Fixed | % Done: | 100% | |
---|---|---|---|---|
Priority: | Normal | |||
Assignee: | Francisco José Peñarrubia | |||
Category: | - | |||
Target version: | - | |||
Severity: | Add-on name: | Unknown | ||
gvSIG version: | 1.12.0 | Add-on version: | ||
gvSIG build: | Add-on build: | |||
Operative System: | Add-on resolve version: | |||
Keywords: | wfs, filter, encoding | Add-on resolve build: | ||
Has patch: | Yes |
Description
There is a problem if WFS attribute filter contains special characters like åäöÅÄÖ
This is how my attribute filter looks in the Query area of the WFS Filter tab
"kunta_ni1" = 'Saarijärvi'
This is the request that gvSIG is sending
There is wrong URL-encoding in <Literal>Saarij%E4rvi</Literal>
Letter "ä" as correctly URL-encoded is %C3%A4
If I edit the GetFeature request above accordingly to contain <Literal>Saarij%C3%E4rvi</Literal>it works
gvSIG seems to do the URL-encoding wrong for other characters do. If I place this string into the filter
test_åäöÅÄÖ_test
it comes out as
<Literal>test_%E5%E4%F6%C5%C4%D6_test</Literal>
but it should come like
<Literal>test_%C3%A5%C3%A4%C3%B6%C3%85%C3%84%C3%96_test</Literal>
I am using gvSIG 1.12 RC2 on Windows XP. Java version is 1.7.0_02 and I did installation from
http://downloads.gvsig.org/download/gvsig-desktop/dists/1.12.0/builds/1414/gvSIG-desktop-1.12.0-1414-RC2-win-x86-standard.exe
Locale is Finland-Finnish.
Regards,
Jukka Rahkonen
History
#1 Updated by Francisco José Peñarrubia almost 12 years ago
It seems the correct encoding for http requests is UTF-8, not Latin1.
This patch will correct the problem (the only change is substitute 8859-1 for UTF-8:
Index: src/com/iver/cit/gvsig/gui/panels/WFSFilterPanel.java
===================================================================
--- src/com/iver/cit/gvsig/gui/panels/WFSFilterPanel.java (revision 37921)
+++ src/com/iver/cit/gvsig/gui/panels/WFSFilterPanel.java (working copy)@ -743,7 +743,10
@
text = text.substring(1, text.length() -1);
// Convert the string to ISO 8859_1 codification
- text = URLEncoder.encode(text, "8859_1");
// text = URLEncoder.encode(text, "8859_1");
// Convert the string to UTF codification (requests are expected to go in this encoding.
+ // See: http://listserv.gva.es/pipermail/gvsig_internacional/2012-August/008559.html
+ text = URLEncoder.encode(text, "UTF-8");
// Change ' (%27 code) to '' for the SQL parser (before send the query)
text = text.replaceAll("\\%27", "\\'\\'");
I think this change will not break nothing and it's safe to put it in SVN. I do and fix it.
#2 Updated by Francisco José Peñarrubia almost 12 years ago
- Status changed from New to Fixed
- % Done changed from 0 to 100
Applied in changeset r38762.
#3 Updated by Francisco Puga almost 12 years ago
The change seems good to me. I pass the persistence test related to WFS and all works.
#4 Updated by Álvaro Anguix over 10 years ago
- Project changed from Application: gvSIG desktop to | gvSIG desktop 1
- Category deleted (
WFS) - Target version deleted (
1.12.0-final)