0 Replies Latest reply on Aug 28, 2009 5:14 AM by Tom Hombergs

    include UTF-8 JSPs in a portlet

    Tom Hombergs Newbie

      Hi all,

      I'm including a UTF-8 JSP in my Portlet's dowView() as in the code snippet below. The JSP contains some non-latin characters (german umlauts, in my case). These characters are not displayed correctly in the browser, however.

      If I simply user response.getWriter().println() to print the same characters, they are displayed correctly.

      Can you configure the dispatcher somehow to set the encoding to UTF8? Any ideas why included JSPs are not displayed UTF8-conform?

      public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException, UnavailableException {
       response.setContentType("text/html");
       String contentUrl = getContentUrl(request, response);
       PortletContext context = getPortletContext();
       PortletRequestDispatcher dispatcher = context.getRequestDispatcher(contentUrl);
       try {
       dispatcher.include(request, response);
       } catch (Exception e) {
       response.getWriter().println("Cannot display content!");
       }
      }