2 Replies Latest reply on May 7, 2003 8:19 AM by pants

    JSP Unicode UTF-8 Problem

    pants Newbie

      Hi,

      I have a JSP which reads and displays some chinese text from a PropertyResourceBundle. The JSP charset is set to UTF-8 (using the @page directive) and it all works fine.

      However....if I type the chinese text directly into the JSP using a Unicode editor and save the file as UTF-8, when the JSP is hit is simply displays garbage... (i.e. "切涉料的��")

      Any ideas what this might be?

        • 1. Re: JSP Unicode UTF-8 Problem
          pants Newbie

          The problem seems to be that when Jasper compiles the .jsp files into .java files it doesn't convert the UTF-8 encoded strings into unicode escapes (i.e. of the form \u***).

          Other JSP engines like Resin perform this conversion and the chinese text displays fine.

          Is this a bug in the Jasper compiler or do I need to set a flag for Jasper to escape UTF-8?

          • 2. Re: JSP Unicode UTF-8 Problem
            pants Newbie

            OK so it seems that jasper can't handle the page contentType being set in an include file. Once its set in the top level page everything works fine.

            Thanks for all your help ;)