• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filter Non Ascii characters

 
Raghu Sha
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks,
 
K. Tsang
Bartender
Posts: 3508
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Raghu Sha
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,

I am using Spring MVC, do i need to write seperate filter for filtering Non Ascii characters or spring provides implementation?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic