CodeIgniter Forums
Validating foreign languages using form validation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Validating foreign languages using form validation (/showthread.php?tid=49333)



Validating foreign languages using form validation - El Forum - 02-15-2012

[eluser]capypara[/eluser]
Hi all. I have these for my rules in form_validation.php

trim|required|max_length[30]|xss_clean|alpha_dash

I do not want the users to enter any potentially harmful characters so i set the alpha_dash rule. However, all non-English characters ended up being regarded as harmful characters as well. How can i allow the user to enter any non-English character and still prevent stuff like /*-%&#" from being entered?


Validating foreign languages using form validation - El Forum - 02-15-2012

[eluser]CroNiX[/eluser]
You would have to make new rules that allowed them.


Validating foreign languages using form validation - El Forum - 02-16-2012

[eluser]@robertotra[/eluser]
When using a framework, often people forget that it is built upon an underlying language: if you do not find what you need inside CI then look into PHP itself:

PHP: Sanitize filters - Manual
http://php.net/manual/en/filter.filters.sanitize.php

Cheers
Roberto