GeoServer
  1. GeoServer
  2. GEOS-256

GetFeatureInfo can return incorrect i18n strings

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.3
    • Fix Version/s: 1.2.4
    • Component/s: WMS
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Quoting my letter sent to GeoServer mailing list:

      It seems that WMS's GetFeatureInfo request is partially affected with
      that default character encoding issue. When asking for GetFeatureInfo
      with "info_format" of "text/plain", "text/html" or without specifying
      output format at all (in that case format defaults to "text/plain"
      which is a bit surprising for me; I would rather expect GML2 to be
      a default one) I see those nasty question marks instead of cyrillic
      letters.

      I believe the above behavior is caused by the way in which `writeTo()`
      method of
      `org.vfny.geoserver.responses.wms.featureInfo.TextFeatureInfoResponse`
      and
      `org.vfny.geoserver.responses.wms.featureInfo.HTMLTableFeatureInfoResponse`
      classes construct their PrintWriter object.

      That looks like this:

      public void writeTo(OutputStream out)
      ...
      PrintWriter writer = new PrintWriter(out);

      As stated by Sun's javadocs, OutputStream-based constructor of
      PrintWriter "creates the necessary intermediate OutputStreamWriter,
      which will convert characters into bytes using the default character
      encoding".

      I think it would be more appropriate not to rely on this automagical
      conversion but construct OutputStreamWriter explicitly using the
      character encoding from "services.xml" file. I.e. after replacing

      PrintWriter writer = new PrintWriter(out);

      with

      OutputStreamWriter osw = new OutputStreamWriter(out,
      getRequest().getGeoServer().getCharSet());
      PrintWriter writer = new PrintWriter(osw);

      in both TextFeatureInfoResponse.java and HTMLTableFeatureInfoResponse.java
      the things are definitely straightens up

      `GmlFeatureInfoResponse` class is not affected by this since it is
      aware of "charSet" configuration setting.

        Activity

        Hide
        Chris Holmes added a comment -

        Set fix version to 1.2.4, assigned to me.

        Show
        Chris Holmes added a comment - Set fix version to 1.2.4, assigned to me.
        Hide
        Chris Holmes added a comment -

        Changed the code in CVS. I'm not yet set up to test the i18n super well, but I put in the fixes, as they make sense to me. If for some reason they didn't get in all the way, then re-open this and I'll try again.

        Show
        Chris Holmes added a comment - Changed the code in CVS. I'm not yet set up to test the i18n super well, but I put in the fixes, as they make sense to me. If for some reason they didn't get in all the way, then re-open this and I'll try again.

          People

          • Assignee:
            Chris Holmes
            Reporter:
            Artie Konin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 5 minutes
              5m
              Remaining:
              Remaining Estimate - 5 minutes
              5m
              Logged:
              Time Spent - Not Specified
              Not Specified