I think you are right. I use too a filter from springframework to force UTF-8 encoding:

<filter>
       <filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
       <init-param>
           <param-name>encoding</param-name>
           <param-value>UTF-8</param-value>
       </init-param>
       <init-param>
           <param-name>forceEncoding</param-name>
           <param-value>true</param-value>
       </init-param>
   </filter>

And the <%page%> stuff and others.


Martin Kindler escribió:

Thank you Dave!

My problem is now solved.
But I had to do a bit more than just say that the pages are UTF-8. I think
it does not matter whether I use the configuration of the Struts controller
to do this or write it explicitly into each jsp.

As several people today had similar problems today here my solution (built
on advice from many people):

first I configured Struts to use UTF-8 (struts-config.xml: <controller
contentType="text/html;charset=UTF-8"  .../>
then I told my forms to accept UTF-8 (html:form with acceptCharset="utf-8")
(this is probably not necessary as the browser will send form data with the
same encoding as the page, but is good for documentation)
at last I installed a little filter on my container (Tomcat 5.0.x) which
explicitly sets the encoding for each request and response to UTF-8. This
proved to be the real solution.

The filter was taken from Mike Gavaghan's very helpful article on End-to-end
internationalization of Web applications
(http://www.javaworld.com/javaworld/jw-05-2004/jw-0524-i18n.html)

Martin

-----Ursprüngliche Nachricht-----
Von: Harland, David [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 7. September 2005 12:15
An: Struts Users Mailing List; [EMAIL PROTECTED]
Betreff: RE: Problem with characters


Make sure the jsp doing the posting has
<%@ page language="java" contentType="text/html; charset=UTF-8" %>

Dave.
-----Original Message-----
From: Martin Kindler [mailto:[EMAIL PROTECTED] Sent: 07 September 2005 10:47
To: 'Struts Users Mailing List'
Subject: AW: Problem with characters

David,

could you please be a bit more specific?

Just now I have a very similar problem as LuKe.
I am using MySQl 4.1.10 and all tables are UTF-8.
Struts is configured to use UTF 8 (i. e. the controller element in struts-config.xml says contentType="text/html;charset=UTF-8").

This seems to work. My browsers (Firefox and IE6) decode the pages as UTF-8.


BUT: when I enter text using a form (this is configured using the charSet-attribute to html:form to accept
ISO-8859-1) IE6 garbles it while Firefox seems to work OK.

Any hints?

Martin

-----Ursprüngliche Nachricht-----
Von: Harland, David [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 7. September 2005 10:35
An: Struts Users Mailing List
Betreff: RE: Problem with characters


Change you encoding to UTF-8.

What database are you using?

Dave.

-----Original Message-----
From: lk [mailto:[EMAIL PROTECTED]
Sent: 07 September 2005 09:23
To: user@struts.apache.org
Subject: Problem with characters

Hi,

I have a problem with some characters.

My application reads some forms and writes them in a db.

On my test and developing environment everything works well.

The problem comes out when I deploy the application on the
production
server.

When I fill in the form non English characters (for example
the typical characters of the Italian language) they are read as "?".

The strange thing is that in the same tomcat context there is an old
no-struts application that works well.

On this server Apache and Tomcat work together and this is the only
difference from my test server.

In both struts-config.xml and web.xml I put this encoding <?xml version="1.0" encoding="ISO-8859-1" ?>

Furthermore I use a tiles layout and in it I put:
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">


What could be the problem?

LuKe



--
Email.it, the professional e-mail, gratis per te:
http://www.email.it/f

Sponsor:
Vuoi risparmiare sino al 70% sugli acquisti? Oliviero non
teme confronti! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3849&d=7-9


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This e mail is from DLA Piper Rudnick Gray Cary UK LLP.

The contents of this email and any attachments are
confidential to the intended recipient. They may not be disclosed to or used by or copied in any way by anyone other than the intended recipient. If this email is received in error, please contact DLA Piper Rudnick Gray Cary UK LLP on +44 (0) 8700 111111 quoting the name of the sender and the
email address to which it has been sent and then delete it.

Please note that neither DLA Piper Rudnick Gray Cary UK LLP
nor the sender accept any responsibility for viruses and it is your responsibility to scan or otherwise check this email and any attachments.
DLA Piper Rudnick Gray Cary UK LLP is a limited liability
partnership registered in England and Wales (registered number OC307847) which provides services from offices in England, Belgium, Germany and the People's Republic of China. A list of members is open for inspection at its registered office and principal place of business 3 Noble Street, London EC2V 7EE. Partner denotes member of a limited liability
partnership.
DLA Piper Rudnick Gray Cary UK LLP is regulated by the Law
Society and is a member of DLA Piper Rudnick Gray Cary, a global legal services organisation, the members of which are separate and distinct legal entities. For further information, please refer to www.dlapiper.com.





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This e mail is from DLA Piper Rudnick Gray Cary UK LLP.

The contents of this email and any attachments are confidential to the intended recipient. They may not be disclosed to or used by or copied in any way by anyone other than the intended recipient. If this email is received in error, please contact DLA Piper Rudnick Gray Cary UK LLP on +44 (0) 8700 111111 quoting the name of the sender and the email address to which it has been sent and then delete it.

Please note that neither DLA Piper Rudnick Gray Cary UK LLP nor the sender accept any responsibility for viruses and it is your responsibility to scan or otherwise check this email and any attachments. DLA Piper Rudnick Gray Cary UK LLP is a limited liability partnership registered in England and Wales (registered number OC307847) which provides services from offices in England, Belgium, Germany and the People's Republic of China. A list of members is open for inspection at its registered office and principal place of business 3 Noble Street, London EC2V 7EE. Partner denotes member of a limited liability partnership.

DLA Piper Rudnick Gray Cary UK LLP is regulated by the Law Society and is a member of DLA Piper Rudnick Gray Cary, a global legal services organisation, the members of which are separate and distinct legal entities. For further information, please refer to www.dlapiper.com.







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to