struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Cavacas" <oo...@rogers.com>
Subject RE: Problem with utf-8 encoding with struts
Date Mon, 17 May 2004 12:07:57 GMT
This is not just a problem with JSTL, it's a "problem" with JSPs in general.
A JSP page will default to the system encoding, and not what you may specify
on the response somewhere up the chain. 

I'm aware of 3 options. 

1) Use a Servlet filter as suggested. This only works on Servlet 2.3 and
higher containers. 

2) add this to the top of your JSPs maybe in an include:
<%@ page contentType = "text/html; charset=UTF-8" %>

3) Use another view technology like Velocity

And that's half the battle. The other half is making sure that you can
accept input as UTF-8. But that's a story for another day.

john

> -----Original Message-----
> From: Ronald van den Heuvel [mailto:Ronald.vandenHeuvel@enovation.nl]
> Sent: May 17, 2004 7:50 AM
> To: Struts Users Mailing List
> Subject: RE: Problem with utf-8 encoding with struts
> 
> Hm ok I will try the filter but this is not the real solution because I
> am not using any other taglibs. Only the standard Struts taglibs.
> 
> 
> 
> -----Original Message-----
> From: Paul McCulloch [mailto:paul.mcculloch@axiossystems.com]
> Sent: maandag 17 mei 2004 13:50
> To: 'Struts Users Mailing List'
> Subject: RE: Problem with utf-8 encoding with struts
> 
> That's an old version I gave the URL for. A better place to look would
> be in
> the Tomcat source.
> 
> Paul
> 
> > -----Original Message-----
> > From: Paul McCulloch [mailto:paul.mcculloch@axiossystems.com]
> > Sent: Monday, May 17, 2004 12:47 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Problem with utf-8 encoding with struts
> >
> >
> > This can happen if you use JSTL tags which overwrite whatever response
> > encoding you set.
> >
> > This can be fixed by using a filter to force the encoding
> >
> > http://www.anassina.com/struts/i18n/SetCharacterEncodingFilter.java
> >
> > Paul
> >
> > > -----Original Message-----
> > > From: Ronald van den Heuvel
> > [mailto:Ronald.vandenHeuvel@enovation.nl]
> > > Sent: Monday, May 17, 2004 12:28 PM
> > > To: user@struts.apache.org
> > > Subject: Problem with utf-8 encoding with struts
> > >
> > >
> > >  Hello all,
> > >
> > >
> > >
> > > I am using Struts for a web-application and the web-page
> > should be in
> > > UTF-8 encoding, but the application keeps sending the
> > > following header:
> > > Content-Type: text/html;charset=ISO-8859-1. I take the
> > > following action
> > > to get the page into UTF-8.
> > >
> > >  - in the struts config file:
> > >
> > >               <controller contentType="text/html;charset=UTF-8"
> > > nocache="true" />
> > >
> > > - in the main tiles layout:
> > >
> > >             <%@ page language="java" contentType="text/xml;
> > > charset=UTF-8" %> (at the top)
> > >
> > >             <meta http-equiv="content-type" content="text/html;
> > > charset=UTF-8">( in the head part of the document)
> > >
> > >
> > >
> > > The page is valid xhtml 1.0 transitional and I get no errors what so
> > > ever. I tested it in mozilla and IE and both say it is the
> > ISO-8859-1
> > > content type.
> > >
> > >
> > >
> > > Does anybody know the solution to this problem?
> > >
> > >
> > >
> > > Thanks
> > >
> > >
> > >
> > > Ronald
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > **********************************************************************
> > Axios Email Confidentiality Footer
> > Privileged/Confidential Information may be contained in this
> > message. If you are not the addressee indicated in this
> > message (or responsible for delivery of the message to such
> > person), you may not copy or deliver this message to anyone.
> > In such case, you should destroy this message, and notify us
> > immediately. If you or your employer does not consent to
> > Internet email messages of this kind, please advise us
> > immediately. Opinions, conclusions and other information
> > expressed in this message are not given or endorsed by my
> > Company or employer unless otherwise indicated by an
> > authorised representative independent of this message.
> > WARNING:
> > While Axios Systems Ltd takes steps to prevent computer
> > viruses from being transmitted via electronic mail
> > attachments we cannot guarantee that attachments do not
> > contain computer virus code.  You are therefore strongly
> > advised to undertake anti virus checks prior to accessing the
> > attachment to this electronic mail.  Axios Systems Ltd grants
> > no warranties regarding performance use or quality of any
> > attachment and undertakes no liability for loss or damage
> > howsoever caused.
> > **********************************************************************
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message