Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [tlug] apache2 setup and japanese charset



> I had exactly same problem when we shifted our JSPs and some 
> static pages to linux/tomcat. Putting <meta 
> http-equiv="Content-Type" content="text/html; 
> charset=Shift_JIS"> in all the pages worked for me, I didn't 
> have to change anything else.

Actually, using <meta> tag is a good practice, but may not solve
the problem all the time. Most browsers recognize encodings by
looking at the http header sent from web server. So if the header
says the encoding is ISO-8859-1, it doesn't matter what you put
in <meta> tag. The browser would try using ISO-8859-1.

So it's best to configure http header with whatever encoding you
intend to use.

[For servlet]
httpServletResponse.setContentType("text/html; charset=Shift_JIS");

[For JSP]
<% @example.com contentType="text/html; charset=Shift_JIS" %>

For Apache, I'm sure there are many ways to handle this, but
prob easiest would be to change default charset to Shift_JIS
as Shift_JIS is a superset of ASCII, if you are not using any
other charset, you should be fine with this.

-mune


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links