Input with non-standard character input

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Input with non-standard character input

Joe Adams-2
I have an input in which symbols like © can be entered.  Inside my action, the input variable has the text Â© where ever the the © was inputted.  How can I fix this?

Thanks,
Joe

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Input with non-standard character input

Matthijs Laan


From: Joe Adams [mailto:[hidden email]]
To: [hidden email] [mailto:[hidden email]]
Sent: Fri, 21 Dec 2012 21:15:41 +0100
Subject: [Stripes-users] Input with non-standard character input

I have an input in which symbols like © can be entered.  Inside my action, the input variable has the text Â© where ever the the © was inputted.  How can I fix this?

I don't think your problem is stripes-specific, but it is a very common problem in web applications. See this page (also relevant if you don't use Tomcat):

http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

The problem you most likely have is

"Most web browsers today do not specify the character set of a request, even when it is something other than ISO-8859-1. This seems to be in violation of the HTTP specification. Most web browsers appear to send a request body using the encoding of the page used to generate the POST (for instance, the <form> element came from a page with a specific encoding... it is that encoding which is used to submit the POST data for that form)."

If you only need special characters in POST requests I would recommend setting all HTML pages you with your forms to UTF-8 and using the org.apache.catalina.filters.SetCharacterEncodingFilter (you can copy this filters' code to your application code if you don't use Tomcat).

Matthijs

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Input with non-standard character input

Joe Adams-2
Thank you, Matthijs!  While it is not really a Stripes problem, I was hoping there was a Stripes solution.  Setting my character encoding on the page doesn't help.  However, I can solve the issue by just eliminating the one bad character I always get.

Thanks,
Joe

From: Matthijs Laan [[hidden email]]
Sent: Saturday, December 22, 2012 3:56 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Input with non-standard character input



From: Joe Adams [mailto:[hidden email]]
To: [hidden email] [mailto:[hidden email]]
Sent: Fri, 21 Dec 2012 21:15:41 +0100
Subject: [Stripes-users] Input with non-standard character input

I have an input in which symbols like © can be entered.  Inside my action, the input variable has the text Â© where ever the the © was inputted.  How can I fix this?

I don't think your problem is stripes-specific, but it is a very common problem in web applications. See this page (also relevant if you don't use Tomcat):

http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

The problem you most likely have is

"Most web browsers today do not specify the character set of a request, even when it is something other than ISO-8859-1. This seems to be in violation of the HTTP specification. Most web browsers appear to send a request body using the encoding of the page used to generate the POST (for instance, the <form> element came from a page with a specific encoding... it is that encoding which is used to submit the POST data for that form)."

If you only need special characters in POST requests I would recommend setting all HTML pages you with your forms to UTF-8 and using the org.apache.catalina.filters.SetCharacterEncodingFilter (you can copy this filters' code to your application code if you don't use Tomcat).

Matthijs

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Input with non-standard character input

Stone, Timothy

If you use Tomcat, but sure to set the server encoding as well.

 

According to the URIencoding attribute documentation in Tomcat, set “... the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, ISO-8859-1 will be used.".

 

For example:

 

<Connector port="8080"

    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

    enableLookups="false" redirectPort="8443" acceptCount="100"

    debug="0" connectionTimeout="20000"

    disableUploadTimeout="true" URIEncoding="UTF-8" />

 

 

From: Joe Adams [mailto:[hidden email]]
Sent: Wednesday, December 26, 2012 10:15 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Input with non-standard character input

 

Thank you, Matthijs!  While it is not really a Stripes problem, I was hoping there was a Stripes solution.  Setting my character encoding on the page doesn't help.  However, I can solve the issue by just eliminating the one bad character I always get.

 

Thanks,

Joe


From: Matthijs Laan [[hidden email]]
Sent: Saturday, December 22, 2012 3:56 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Input with non-standard character input

 


From: Joe Adams [hidden email]
To: [hidden email] [hidden email]
Sent: Fri, 21 Dec 2012 21:15:41 +0100
Subject: [Stripes-users] Input with non-standard character input

I have an input in which symbols like © can be entered.  Inside my action, the input variable has the text Â© where ever the the © was inputted.  How can I fix this?

 

I don't think your problem is stripes-specific, but it is a very common problem in web applications. See this page (also relevant if you don't use Tomcat):

http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

The problem you most likely have is

"Most web browsers today do not specify the character set of a request, even when it is something other than ISO-8859-1. This seems to be in violation of the HTTP specification. Most web browsers appear to send a request body using the encoding of the page used to generate the POST (for instance, the <form> element came from a page with a specific encoding... it is that encoding which is used to submit the POST data for that form)."

If you only need special characters in POST requests I would recommend setting all HTML pages you with your forms to UTF-8 and using the org.apache.catalina.filters.SetCharacterEncodingFilter (you can copy this filters' code to your application code if you don't use Tomcat).

Matthijs


Barclaycard

www.barclaycardus.com

This email and any files transmitted with it may contain confidential and/or proprietary information. It is intended solely for the use of the individual or entity who is the intended recipient. Unauthorized use of this information is prohibited. If you have received this in error, please contact the sender by replying to this message and delete this material from any system it may be on.


------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users