michel wrote:

----- Original Message ----- From: "michel" <compu...@videotron.ca>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Tuesday, August 03, 2010 1:08 PM
Subject: Re: UTF-8 encoding in Tomcat 6.0



----- Original Message ----- From: "michel" <compu...@videotron.ca>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Tuesday, August 03, 2010 9:35 AM
Subject: Re: UTF-8 encoding in Tomcat 6.0


I am having a simmilar problem with Tomcat Version 6.0.26. I have a JSP with some french characters that run quite well on my local windows machine.When I transfer the JSP source code to the Linux server the JSP gets converted to java source code with the wrong character set. I have played with all kinds of variations of

<%@ page language="java" errorPage="/ErrorPage.jsp" pageEncoding="ISO-8859-1" contentType="text/html;charset=ISO-8859-1"%>


with no change. I am assuming that my jsp to servlet is set wrong ...



Michel



Just looking for a hint here in the right direction ...


The JSP is compiled by jasper-compiler-jdt.jar, but in the previous versions it was javac. So I assume that the reason why my French characters in the jsp are being whacked when converted to a .java file is that I am missing a configuration parameter in a file.

Thanks!



Michel



Got it fixed with <%@ page language="java" errorPage="/ErrorPage.jsp" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1" %>


See : http://java.sun.com/products/jsp/syntax/1.2/syntaxref1210.html

# contentType="mimeType [; charset=characterSet ]" |

       "text/html;charset=ISO-8859-1"

The MIME type and character encoding the JSP page uses for the response. You can use any MIME type or character set that are valid for the JSP container. The default MIME type is text/html, and the default character set is ISO-8859-1.

# pageEncoding="characterSet | ISO-8859-1"

The page source character encoding. The value is a IANA charset name. The default character encoding is ISO-8859-1.


In other words,
- the contentType specifies in which character set and encoding the /result/ will be sent to the browser. - the pageEncoding is destined to the JSP compiler : it tells the compiler in which character set and encoding your JSP "program" is written, so that the compiler can read it properly.

If you use an UTF-8 capable editor, then you could edit and save your JSP page as a Unicode/UTF-8 file, and then change the pageEncoding to say : pageEncoding="UTF-8". In the absolute, that would be more logical, if the response to the browser should be UTF-8 anyway.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to