• Bug
  • Status: Closed
  • Resolution: Fixed
  • drb
  • Reporter: sourceforgetracker
  • September 21, 2009
  • 0
  • Watchers: 0
  • September 22, 2009
  • September 22, 2009

Description

Hi,

I have been using ehcache for a long time already, but I just recently came across this handy Servlet Filter.

Caching worked fine out of the box, but there is a problem with the encoding of the ResponseWrapper.

My pages write in Japanese (Shift_JIS), but the writer given to my JSPs does not seem to take care of the encoding.

net.sf.ehcache.constructs.web.GenericResponseWrapper says:

public PrintWriter getWriter() { if (writer == null) { writer = new PrintWriter(outstr, true); } return writer; }

I changed the writer to:

public PrintWriter getWriter() {
    if (writer == null) {
     if (getCharacterEncoding() != null) {
      try {
 writer = new PrintWriter(new OutputStreamWriter(outstr, getCharacterEncoding()), true);
} catch (UnsupportedEncodingException e) {
 LOG.error("UnsupportedEncodingException blah blah", e);
 writer = new PrintWriter(outstr, true);
}
     } else {
      writer = new PrintWriter(outstr, true);
     }
    }
    return writer;
}

and my page is displayed in Japanese.

Best regards,

Manri Sourceforge Ticket ID: 1954697 - Opened By: manri_offermann - 30 Apr 2008 05:35 UTC

Comments

Fiona OShea 2009-09-22

Re-opening so that I can properly close out these issues and have correct Resolution status in Jira