Hi,
I've got a pretty weird problem here with geotools 2.1.0 and a wfs.
I'm trying to execute a wfs query from a java servlet, the servlet get's
a string via AJAX that is used in the query. The problem is that this
string is encoded in 3 different encodings on 3 different systems:
System A: Linux/tomcat runs in UTF-8 locale, Java String is encoded in UTF-8
System B: Windows XP, Java String is encoded in UTF-8
System C: Linux/tomcat runs in [EMAIL PROTECTED] everything else is
POSIX, the Java String seems to be encoded in UTF-8 twice, i.e. I get 4
bytes for every non-ascii character.
The real problem is, that I can't use SystemA and SystemC to query a
geoserver wfs, they won't find any feature with non-ascii name. It works
on System B out of the box, though. The geoserver always runs on the
same machine in a different tomcat, the postgis database uses LATIN1
encoding and querying the geoserver from php using mapbender is no problem.
I tried first with a simple decode from UTF-8 like this:
decodedParam = Charset.forName("utf-8").decode(input.getBytes()).toString();
Doing this results in the following string on the 3 systems:
System A: No change at all, decodedParam == input, i.e. UTF-8 encoded
System B: decodedParam is now encoded in latin1, it can be read in a
debugger as is (i.e. I see german umlauts as usual)
System C: decodedParam is now a latin1 string with 2 question marks at
the place where I had 4 bytes before.
Putting this string into a LikeFilter results in
System A: No return values
System B: An encoding exception because geotools sends an xml request to
geoserver with declared encoding UTF-8 but used encoding for this string
is latin1
System C: Everything that has 2 characters at the place where a german
umlaut was given in the form (i.e. for Lün it would return features with
the names Linne, Leon...)
I always thought Java strings would be using Unicode codepoints instead
of bytes, but it seems I was wrong.
I'm running out of options here, so if anybody could shed some light
onto this, please?
Andreas
--
Andreas Pakulat
Computer Graphics Center (ZGDV e. V.)
Joachim-Jungius-Str. 11
18059 Rostock
GERMANY
mail: [EMAIL PROTECTED]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users