You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by radiatejava <ra...@gmail.com> on 2015/04/20 16:45:36 UTC

French chars not displayed correctly - Tomcat 7

Hello Tomcat users, have code like this in my jsp:

<td>"${pageKeys.ui_user_name_label}";</td>

Where <td> represents a cell of an html table.

Value of the variable pageKeys.ui_user_name_label populated in server
side is in french and it is exactly as shown below:

Nom d'utilisateur

However, while displaying this in the browser, this is getting displayed as:

Nom d&rsquo;utilisateur


How can I get this corrected ? When I try to see the source code, I
see something like this:

out.write((java.lang.String)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageKeys.ui_user_name_label}",
java.lang.String.class,
(javax.servlet.jsp.PageContext)_jspx_page_context, null, false));

What I want to know from developers here is whether the above code
really does some escaping/encoding of the content ? Is a there a way
to avoid this encoding ?

Appreciate your reply.

Thanks.

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


Re: French chars not displayed correctly - Tomcat 7

Posted by Mark Thomas <ma...@apache.org>.
On 20/04/2015 15:49, Neill Lima wrote:
> Try adding this to your html:
> 
> <head>
> *<meta charset="UTF-8">*
> </head>
> 
> On Mon, Apr 20, 2015 at 4:45 PM, radiatejava <ra...@gmail.com> wrote:
> 
>> Hello Tomcat users, have code like this in my jsp:
>>
>> <td>"${pageKeys.ui_user_name_label}";</td>
>>
>> Where <td> represents a cell of an html table.
>>
>> Value of the variable pageKeys.ui_user_name_label populated in server
>> side is in french and it is exactly as shown below:
>>
>> Nom d'utilisateur
>>
>> However, while displaying this in the browser, this is getting displayed
>> as:
>>
>> Nom d&rsquo;utilisateur
>>
>>
>> How can I get this corrected ? When I try to see the source code, I
>> see something like this:
>>
>> out.write((java.lang.String)
>>
>> org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageKeys.ui_user_name_label}",
>> java.lang.String.class,
>> (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
>>
>> What I want to know from developers here is whether the above code
>> really does some escaping/encoding of the content ?

Tomcat will use whatever encoding you have configured for the JSP page.
If you don't define an encoding then the default will be used. Note that
using '<meta charset="UTF-8">' is just meaningless template text as far
as Tomcat is concerned and will have no impact on how Tomcat generates
the page.

>> Is a there a way to avoid this encoding ?

You cannot avoid encoding. You have to define the mapping you wish to
use to map from bytes to characters. If you do not, the default will be
used.

You should take a look at the Character Encoding part of the FAQ on the
wiki:
http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

Mark


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


Re: French chars not displayed correctly - Tomcat 7

Posted by radiatejava <ra...@gmail.com>.
Of course I have that in my html page.
My aim was to ask whether tomcat (its libraries) itself is doing
encoding of special chars.

Thanks.

On Mon, Apr 20, 2015 at 8:19 PM, Neill Lima <ne...@visual-meta.com> wrote:
> Try adding this to your html:
>
> <head>
> *<meta charset="UTF-8">*
> </head>
>

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


Re: French chars not displayed correctly - Tomcat 7

Posted by Neill Lima <ne...@visual-meta.com>.
Try adding this to your html:

<head>
*<meta charset="UTF-8">*
</head>

On Mon, Apr 20, 2015 at 4:45 PM, radiatejava <ra...@gmail.com> wrote:

> Hello Tomcat users, have code like this in my jsp:
>
> <td>"${pageKeys.ui_user_name_label}";</td>
>
> Where <td> represents a cell of an html table.
>
> Value of the variable pageKeys.ui_user_name_label populated in server
> side is in french and it is exactly as shown below:
>
> Nom d'utilisateur
>
> However, while displaying this in the browser, this is getting displayed
> as:
>
> Nom d&rsquo;utilisateur
>
>
> How can I get this corrected ? When I try to see the source code, I
> see something like this:
>
> out.write((java.lang.String)
>
> org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageKeys.ui_user_name_label}",
> java.lang.String.class,
> (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
>
> What I want to know from developers here is whether the above code
> really does some escaping/encoding of the content ? Is a there a way
> to avoid this encoding ?
>
> Appreciate your reply.
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>