You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by michel <co...@videotron.ca> on 2010/08/03 23:02:03 UTC

Re: UTF-8 encoding in Tomcat 6.0 fixed

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


>
> ----- Original Message ----- 
> From: "michel" <co...@videotron.ca>
> To: "Tomcat Users List" <us...@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" %> 


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


Re: UTF-8 encoding in Tomcat 6.0 fixed

Posted by michel <co...@videotron.ca>.
----- Original Message ----- 
From: "André Warnier" <aw...@ice-sa.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, August 03, 2010 5:30 PM
Subject: Re: UTF-8 encoding in Tomcat 6.0 fixed


> michel wrote:
>>
>> ----- Original Message ----- From: "michel" <co...@videotron.ca>
>> To: "Tomcat Users List" <us...@tomcat.apache.org>
>> Sent: Tuesday, August 03, 2010 1:08 PM
>> Subject: Re: UTF-8 encoding in Tomcat 6.0
>>
>>
>>>
>>> ----- Original Message ----- From: "michel" <co...@videotron.ca>
>>> To: "Tomcat Users List" <us...@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.


Thanks for the info, and I took a look at the page link you showed. It can 
be a real eye-opener to look at actual specs and to see stuff that I had no 
idea even exists.



Michel
^anks fior 


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


Re: UTF-8 encoding in Tomcat 6.0 fixed

Posted by André Warnier <aw...@ice-sa.com>.
michel wrote:
> 
> ----- Original Message ----- From: "michel" <co...@videotron.ca>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Tuesday, August 03, 2010 1:08 PM
> Subject: Re: UTF-8 encoding in Tomcat 6.0
> 
> 
>>
>> ----- Original Message ----- From: "michel" <co...@videotron.ca>
>> To: "Tomcat Users List" <us...@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org