tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Schönhaber <>
Subject Re: getting "?" instead of "¢"
Date Mon, 17 Jul 2006 11:56:05 GMT
David Delbecq wrote:
> This is not a matter of saving the jsp/html file on server with the good
> charset, 

It is.

> this is a matter of using the correct entity reference (&cent;) 
> which is supposed to be displayable by any html 2.0 compliant browser.

Using an entity reference is just one way to get "special" characters 
transmitted to the client. But this will only work if this entity reference 
is defined/recocgnized/interpreted in the output format used - for example in 
HTML. For other output formats - for example plain text - this will obviously 
be useless.
Since - in my experience - modern clients on modern OSes can handle correctly 
encoded input just fine (if they are told how it's encoded), I see no general 
need to cope with entity references. It all boils down to the fact that the 
encoding declared in the HTTP header and the encoding actually used have to 

So I'd also stick with Ronald's proposal and create correctly encoded output.

The following - if saved as UTF-8 - should work as expected:

<%@ page language="java" contentType="text/html; charset=UTF-8"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Display a cent</title>
<p>These are two cents: ¢ &cent;

BTW: it isn't strictly neccessary to use UTF-8. Using a charset that contains 
all symbols used is enough. This mail for example should use ISO-8859-1 as 
charset and still contain the literal cent sign above correctly encoded.
Nevertheless I'd prefer UTF-8 on the web as a more universal approach.


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message