aspose file tools*
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
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: 122
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: 2596
    
    9

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 OCPBCD5
Raghu Sha
Ranch Hand

Joined: Feb 02, 2013
Posts: 122
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