<br><font size=2 face="sans-serif">Hi all</font>
<br>
<br><font size=2 face="Arial">For experimental purpose I added a &quot;UTF-8
-&gt; ISO-8859-Conversion&quot; </font>
<br><font size=2 face="Arial">in two functions of mapscript_wrap.c</font>
<br><font size=2 face="Arial">The functions are the JNI-Implementations
of mapObj.getLayerByName and </font>
<br><font size=2 face="Arial">layerObj.queryByAttributes.</font>
<br>
<br><font size=2 face="Arial">I testet with the QueryByAttribute-Program
Umberto send and with a Shapefile (no database).</font>
<br><font size=2 face="Arial">I tested to find the layer named &quot;</font><font size=2><tt>ÜÄÖßäüö</tt></font><font size=2 face="Arial">&quot;
and in this layer the regular-expression</font>
<br><font size=2><tt>&quot;Süden</tt></font><font size=2 face="Arial">&quot;.</font>
<br>
<br><font size=2 face="Arial">On my Windows-machine the results seem to
be correct for the Command-Line-</font>
<br><font size=2 face="Arial">parameter-case and for the hardcoded-case.</font>
<br>
<br><font size=2 face="Arial">The implementation is experimental only.
If strings are longer than 500 chars,</font>
<br><font size=2 face="Arial">unforeseeable things may happen. In practice
one should think twice wether to</font>
<br><font size=2 face="Arial">use this kind of implementation or to use
the build-in Java-encoders from JNI level.</font>
<br>
<br><font size=2 face="Arial">But the really difficult question is how
anything like this could be reasonably incorporated </font>
<br><font size=2 face="Arial">with swig. I have no idea!</font>
<br>
<br><font size=2 face="Arial">Umberto? What do you think?</font>
<br>
<br><font size=2 face="Arial">Norbert: To be honorable, I don't think it
is promising to change the Strings in the </font>
<br><font size=2 face="Arial">higher Java-level. </font>
<br>
<br><font size=2 face="Arial">For some days code with example can be dowloaded
from</font>
<br><font size=2 face="Arial">http://www2.hydrotec.de/webdemos/be/umlaute.zip</font>
<br><font size=2 face="Arial">(Compiled mapscript.dll is included. Other
dll's can be used from normal </font>
<br><font size=2 face="Arial">mapserver 4.8.2)</font>
<br>
<br><font size=2 face="Arial">Benedikt</font>
<br>
<br><font size=2 face="Arial">PS: I think of this as a bug in mapserver.
Should a bug in bugzilla be opened?</font>
<br>
<br><font size=2><tt>listuser HH &lt;listuser@herzsys.de&gt; schrieb am
19.04.2006 10:05:13:<br>
<br>
&gt; Hi Benedikt,<br>
&gt; <br>
&gt; thanks for the interest. I have the encoding problem when I try to
<br>
&gt; &quot;getLayerByName()&quot;. I could get around the problem at this
point but I <br>
&gt; think I will have the problem later again. So testing is easy - I
just <br>
&gt; use a simple layer with the name &quot;Regierungspräsidien&quot;.
When I use this <br>
&gt; string to get the layer by name it doesn't work. To be sure I tried
to <br>
&gt; check this string with the name of the layer which I get from <br>
&gt; map.getLayer(0) - which is equal to the other.<br>
&gt; <br>
&gt; My thought was to convert the string before using it in mapscript
<br>
&gt; functions. Java brings two things to convert strings - perhaps there
are <br>
&gt; more.<br>
&gt; <br>
&gt; 1. make a new String from the old in a special encoding - e.g. --&gt;
new <br>
&gt; String(oldString.getBytes(), &quot;ISO8859-1&quot;)<br>
&gt; 2. convert chars to different encoding - e.g. [snip] --&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; CharToByteISO8859_1 conv4ISO = new <br>
&gt; CharToByteISO8859_1();<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; char[] cs = layerName.toCharArray();<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; conv4ISO.convert(charArray, 0, charArray.length, <br>
&gt; byteArray, 0, byteArray.length);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; new String(byteArray);<br>
&gt; <br>
&gt; Because I'm not sure about which encodings are used at wich stpes
I <br>
&gt; tried some combinations but without luck. I think my code from eclipse
<br>
&gt; is CP1252. In the eclipse editor properties I changed this to UTF8
and <br>
&gt; ISO which also didn't work. I tried to I'm not sure what happens when
<br>
&gt; mapscript use JNI. Perhaps the string gets converted to UTF8. If this
is <br>
&gt; right I see no chance for me to change the string in java because
it <br>
&gt; gets converted even if it is already UTF8. I have to say that I'm
not <br>
&gt; familiar with this encoding things. If someone has an advice I will
<br>
&gt; going on testing.<br>
&gt; <br>
&gt; I think it will be a good thing to have &quot;UTF-8 -&gt; ISO-8859-Conversion&quot;
<br>
&gt; like you suggested. At the moment I can't do this because I have no
<br>
&gt; possibility to compile the c code.<br>
&gt; <br>
&gt; Best regards,<br>
&gt; <br>
&gt; Norbert<br>
&gt; <br>
&gt; Benedikt Rothe wrote:<br>
&gt; <br>
&gt; &gt;Umberto, Nicol, Norbert, Oliver<br>
&gt; &gt;<br>
&gt; &gt;Umberto wrote<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;try to run the attached Java source. <br>
&gt; &gt;&gt; &nbsp; &nbsp;<br>
&gt; &gt;&gt;<br>
&gt; &gt;...<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;&quot;Südliche Weinstraße&quot; as the second it will work!<br>
&gt; &gt;&gt; &nbsp; &nbsp;<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt;In my copy of your mail the queryByAttribute.java-program is not
<br>
&gt; &gt;attached. &nbsp;Could somebody post program including testdata
(or <br>
&gt; &gt;download-url) ?<br>
&gt; &gt;<br>
&gt; &gt;I 'd like to study a running example, because I don't understand
<br>
&gt; &gt;how umlaut-conversion from Java to Mapserver-kernel can run <br>
&gt; &gt;properly anyway and I'd like to understand it :-)<br>
&gt; &gt;-----------<br>
&gt; &gt;It seems Norbert found a kind of answer to his question <br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;is there a way to do the converion in java dircetly?<br>
&gt; &gt;&gt; &nbsp; &nbsp;<br>
&gt; &gt;&gt;<br>
&gt; &gt;He suggested<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;Try to convert the String before you set the expression in
your code(-&gt; <br>
&gt; &gt;&gt; &nbsp; &nbsp;<br>
&gt; &gt;&gt;<br>
&gt; &gt;String( byte <br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;bytes[], String ) <br>
&gt; &gt;&gt; &nbsp; &nbsp;<br>
&gt; &gt;&gt;<br>
&gt; &gt;Could you be more precisly? I do not understand what must be converted
to <br>
&gt; &gt;what.<br>
&gt; &gt;How must this be applied to convert a Java-String to a proper
<br>
&gt; &gt;&quot;Mapserver-String&quot; (?)<br>
&gt; &gt;-----------<br>
&gt; &gt;Is somebody willing to try to add an &quot;UTF-8 -&gt; ISO-8859-Conversion&quot;
in<br>
&gt; &gt;mapscript_wrap.c for testpurposes? (Even in the case it works,
this would <br>
&gt; &gt;not be a real solution because it bypasses swig.)<br>
&gt; &gt;<br>
&gt; &gt;Benedikt<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;UMN MapServer Users List &lt;MAPSERVER-USERS@LISTS.UMN.EDU&gt;
schrieb am <br>
&gt; &gt;14.04.2006 15:23:51:<br>
&gt; &gt;<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;Olivier,<br>
&gt; &gt;&gt;I GOT IT!<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;try to run the attached Java source. If you pass it two arguments
the<br>
&gt; &gt;&gt;first being the path to the map file and the second the string
to<br>
&gt; &gt;&gt;search for and you pass<br>
&gt; &gt;&gt;&quot;Südliche Weinstraße&quot; as the second it will work!<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;So why does it fail when &quot;Südliche Weinstraße&quot; is
inside the Java<br>
&gt; &gt;&gt;code? That is a problem that only happens when javac compiles
the<br>
&gt; &gt;&gt;source: javac translates all characters to unicode and in
doing that<br>
&gt; &gt;&gt;it gets the german characters wrong.<br>
&gt; &gt;&gt;To solve this give javac the following option: -source 1.4<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;For more see this link:<br>
&gt; &gt;&gt;http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5046139<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;On 4/13/06, Umberto Nicoletti &lt;umberto.nicoletti@gmail.com&gt;
wrote:<br>
&gt; &gt;&gt; &nbsp; &nbsp;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;&gt;This is probably not related only to java mapscript, so
please read <br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;on.<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;So I was wrong...but I'll leave the proof to the reader ;-)<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;Best regards,<br>
&gt; &gt;&gt;Umberto<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; &nbsp; &nbsp;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;&gt;On 3/30/06, Oliver Wesp &lt;wesp@gdv.com&gt; wrote:<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;Dear List,<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;I' struggling with queryByAttributes on an attribute
field with <br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;german<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;&gt;&gt;umlauts using java mapscript.<br>
&gt; &gt;&gt;&gt;&gt;The odd thing is that the same thing works fine with
php mapscript <br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;and<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;&gt;&gt;when I use expressions in my &nbsp;mapfile. I'm using
a shapefile as <br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;datasource.<br>
&gt; &gt;&gt; &nbsp; &nbsp;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;&gt;Could someone of the other mapserver developers shed some
light on<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;this issue?<br>
&gt; &gt;&gt; &nbsp; &nbsp;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;&gt;I have a clue to give: php mapscript is using a different
regex<br>
&gt; &gt;&gt;&gt;library and this explains why the match does not happen
for Java<br>
&gt; &gt;&gt;&gt;mapscript, while it does happen in php mapscript. If I
am right also<br>
&gt; &gt;&gt;&gt;the mapserver cgi should be affected and possibly all
other mapscript<br>
&gt; &gt;&gt;&gt;too.<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;It would be very interesting if someone could report on
similar<br>
&gt; &gt;&gt;&gt;experiences with the cgi-bin version of mapserver.<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;Thanks,<br>
&gt; &gt;&gt;&gt;Umberto<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;Here is what I do:<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;layer.queryByAttributes(map,&quot;KREIS_NAME&quot;,
&quot;/Südliche Weinstraße/&quot;,<br>
&gt; &gt;&gt;&gt;&gt;mapscriptConstants.MS_MULTIPLE);<br>
&gt; &gt;&gt;&gt;&gt;layer.open();<br>
&gt; &gt;&gt;&gt;&gt;System.out.println( &quot;Result Count: &quot; +layer.getNumResults()
);<br>
&gt; &gt;&gt;&gt;&gt;layer.close();<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;The result is always null while replacing the qstring
with something<br>
&gt; &gt;&gt;&gt;&gt;that doesn't contain special characters (e.g.<br>
&gt; &gt;&gt;&gt;&gt;'Mainz-Bingen') works fine.<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;As noted above the following layer definition in a
mapfile works <br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;fine<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;&gt;&gt;LAYER<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; NAME kreis<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; STATUS DEFAULT<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; TYPE polygon<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; DATA &quot;/tmp/subset&quot;<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; TEMPLATE &quot;kreis.html&quot;<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; CLASSITEM KREIS_NAME<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; CLASS<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; NAME Boundary<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; COLOR 128 128 0<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; OUTLINECOLOR 0 0 0<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; EXPRESSION /Südliche Weinstraße/<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; END<br>
&gt; &gt;&gt;&gt;&gt;END<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;but this does not:<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;layer.setClassitem(&quot;KREIS_NAME&quot;);<br>
&gt; &gt;&gt;&gt;&gt;classObj cl = new classObj(layer);<br>
&gt; &gt;&gt;&gt;&gt;cl.setName(&quot;Classname&quot;);<br>
&gt; &gt;&gt;&gt;&gt;cl.setExpression(&quot;/Südliche Weinstraße/&quot;);<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;I use Mapserver 4.8.1 on W2k, Tomcat 5.0.28.<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;I can provide some sample data, just in case someone
likes to <br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;reproduce.<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&gt;&gt;&gt;Any help is appreciated.<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;best regards<br>
&gt; &gt;&gt;&gt;&gt;Oliver<br>
&gt; &gt;&gt;&gt;&gt;--<br>
&gt; &gt;&gt;&gt;&gt;Dipl.-Geogr. Oliver Wesp<br>
&gt; &gt;&gt;&gt;&gt;Gesellschaft fuer geografische Datenverarbeitung<br>
&gt; &gt;&gt;&gt;&gt;Binger Strasse 49-51<br>
&gt; &gt;&gt;&gt;&gt;D-55218 Ingelheim<br>
&gt; &gt;&gt;&gt;&gt;fon: +49 6132 714818<br>
&gt; &gt;&gt;&gt;&gt;fax: +49 6132 714828<br>
&gt; &gt;&gt;&gt;&gt;http: www.gdv.com<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt; &nbsp;<br>
&gt; &gt;<br>
&gt; <br>
&gt; <br>
</tt></font>