tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Character set issue
Date Tue, 06 Dec 2011 15:15:09 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

On 12/4/11 8:02 PM, Konstantin Kolinko wrote:
> Make sure that content type and charset value in a) Content-Type
> HTTP header sent by server and b) in META tag in HTML text have
> _literally_ the same value. If they both are present and they do 
> not match, odd things may happen in "non-compliant" browsers.

I almost always do the following at the top of my pages (JSP shows,
but you get the idea for any templating system):

<html>
<head>
  <meta http-equiv="Content-Type"
        content="text/html<% null == response.getCharacterEncoding()
                             ? ""
                             : ";" + response.getCharacterEncoding() %>"
  />

I do this so that, in case the response encoding gets changed from
whatever I think it is, I don't report the wrong one. You don't want
the page to say UTF-8 when the encoding is really SHIFT-JS or
something else.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7eMX0ACgkQ9CaO5/Lv0PAciQCgxAvIxddldpVlv4tK/1F+47+X
lIIAnRtDaIg2Tl5zIQiKMtPPjKt6IaVZ
=2YHA
-----END PGP SIGNATURE-----

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


Mime
View raw message