This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Spring and the fly likes Filter Non Ascii characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Filter Non Ascii characters" Watch "Filter Non Ascii characters" New topic
Author

Filter Non Ascii characters

Raghu Sha
Ranch Hand

Joined: Feb 02, 2013
Posts: 120
Hi,

How to filter Non Ascii characters from user input using web filter.
Please share the sample code.

Thanks,
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2231
    
    7

You will need to write a CharacterEncodingFilter setting the encoding to say UTF8 for the response and request. If you are not familiar with writing a filter writing javax.servlet.filter

Remember to add this Filter to your web.xml file.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Raghu Sha
Ranch Hand

Joined: Feb 02, 2013
Posts: 120
Thanks,

I am using Spring MVC, do i need to write seperate filter for filtering Non Ascii characters or spring provides implementation?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filter Non Ascii characters
 
Similar Threads
String Encoding
force users to use english character set
Binary files
Unable to print Swedish Character using DocFlavor
what is default value for char array?