[Geoserver-devel] [jira] Created: (GEOS-256) GetFeatureInfo can return incorrect i18n strings

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/GEOS-256

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: GEOS-256
    Summary: GetFeatureInfo can return incorrect i18n strings
       Type: Bug

     Status: Open
   Priority: Minor

Original Estimate: Unknown
Time Spent: Unknown
  Remaining: Unknown

    Project: GeoServer
Components:
             WMS
   Versions:
             1.2.3

   Assignee: Gabriel Roldán
   Reporter: Artie Konin

    Created: Wed, 1 Dec 2004 1:19 AM
    Updated: Wed, 1 Dec 2004 1:19 AM

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 :slight_smile:

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

---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira