[Geoserver-devel] Re: That's about GEOS-258 part 2 *sigh*

Very cool. Internationalization help is always appreciated. Looks like
great work. Could you submit a new jira task for this stuff? And then
if you have permissions link from 258. Schedule it for 1.3.0. Gabriel
is looking to reorganize the util package, so hopefully when he does
that he can slot things in. And do go ahead and use the devel list
directly - we getting more core geoserver developers past just me, so
things may get lost if only I see them.

thanks again,

Chris

Quoting Artie Konin <a-thor@anonymised.com>:

Greetings, Chris,

Sorry for the previous post, it is incompleted :slight_smile: As usual, that bad
habit of pressing F2 to save the text plays a bad joke with me :slight_smile:

So, in a few words, the changes I made to do the charset detection
in
GeoServer are:

1. Slightly modified org.vfny.geoserver.servlets.AbstractService
   Commented a line in doPost:

    Reader xml = (requestXml != null) ? requestXml :
request.getReader();

   and added following instead:

    Reader xml;
    if (null != requestXml) {
        xml = requestXml;
    } else {
        /*
         * `getCharsetAwareReader` returns a reader which not support
         * mark/reset. So it is a good idea to wrap it into
BufferedReader.
         * In this case the below debug output will work.
         */
        xml = new BufferedReader(
                  XmlCharsetDetector.getCharsetAwareReader(
                      request.getInputStream()));
    }

   also imported two new classes:

   import java.io.BufferedReader;
   import org.vfny.geoserver.util.requests.XmlCharsetDetector;

   That's all included in AbstractService version I placed in
archive.
   It is based on the file from 3304 revision of geoserver trunk.
   But I believe the above information is sufficient to apply the
   changes manually.

2. Added four utility classes. I placed them in 'util', but that's
   because I have no any brighter ideas :slight_smile:

org.vfny.geoserver.util.requests.XmlCharsetDetector;
org.vfny.geoserver.util.requests.RewindableInputStream;
org.vfny.geoserver.util.requests.EncodingInfo;
org.vfny.geoserver.util.requests.readers.UCSReader;

   XmlCharsetDetector is a detector class itself, it uses other three
   in the process. UCSReader can be avoided by commenting out a few
   lines in XmlCharsetDetector, but this will eliminate
ISO-10646-UCS-4
   support (don't know if such support is really needed :slight_smile:

   I tested the stuff with sample requests in Windows-1251,
   ISO-8859-5, UTF-8, UCS-4 (both LE and BE), UTF-16, UTF-16LE &
   UTF-16BE. And that's worked for me. Still the code is somewhat
   undertested and may yield some troubles. Don't know if it is worth
   adding right now with all that refactoring stuff etc. :slight_smile:

   Ok, anyway, I'm sending you the results and will wait for the
   feedback :slight_smile: Hope it helps.

--
WBR,
Artie Konin aka A-Thor mailto:a-thor@anonymised.com

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/