es131245 Posted August 4, 2009 Report Share Posted August 4, 2009 HAHA php doent know russian alphabet =))))))))))))))))))itsa input filters =))))))))filter should check length of an input and symbols of BOTH languages ENG+RUS $irl=$_POST["irl"];if (eregi("<[a-zа-я]{6,15}>",$irl,$temp0)){ [i]/*Input is good now mysql_connect() */[/i] } else {$er="irl"}if ($er){echo "<script language=\"javascript\">alert(\"Wrong $er\");</script>";} what is wrong... [a-zа-я]!!!!!!!if we inputaaaaaa +bbbbbb +AAAAAA +BBBBBB +аааааа + (first rus letter)бббббб + (second rus letter)АААААА - (first upper size rus letter)ББББББ - (second upper size rus letter)йййййй + (rus letter №11)ЙЙЙЙЙЙ - (upper rus letter №11)фффффф - (rus letter)How come that not all rus letters are read by php??? Link to comment Share on other sites More sharing options...
Ingolme Posted August 4, 2009 Report Share Posted August 4, 2009 (edited) Probably because the character codes have assigned Unicode numbers lower than а or higher than я.And your regular expression is only seems to be checking lowercase letters. Edited August 4, 2009 by Ingolme Link to comment Share on other sites More sharing options...
es131245 Posted August 4, 2009 Author Report Share Posted August 4, 2009 (edited) XHTML 1.0 Strictcharset="utf-8"And ereg() Searches a string for matches to the regular expression given in pattern in a case-sensitive way. eregi() This function is identical to ereg() except that it ignores case distinction when matching alphabetic characters. http://ru2.php.net/function.ereghttp://ru2.php.net/eregi Edited August 4, 2009 by es131245 Link to comment Share on other sites More sharing options...
Ingolme Posted August 4, 2009 Report Share Posted August 4, 2009 XHTML 1.0 Strictcharset="utf-8"And ereg() Searches a string for matches to the regular expression given in pattern in a case-sensitive way. eregi() This function is identical to ereg() except that it ignores case distinction when matching alphabetic characters. http://ru2.php.net/function.ereghttp://ru2.php.net/eregi Even if encoded in UTF-8, the order of the characters is the same as in unicode.I'm checking the character map, there appear to be cyrilic characters beyond я.Try this instead:[a-zа-ө] Link to comment Share on other sites More sharing options...
es131245 Posted August 4, 2009 Author Report Share Posted August 4, 2009 aaaaaa +bbbbbb +AAAAAA +BBBBBB +аааааа + (first rus letter)бббббб + (second rus letter)АААААА - (first upper size rus letter)ББББББ - (second upper size rus letter)йййййй + (rus letter №11)ЙЙЙЙЙЙ - (upper rus letter №11)фффффф - (rus letter)Same Result! Link to comment Share on other sites More sharing options...
es131245 Posted August 4, 2009 Author Report Share Posted August 4, 2009 (edited) Ive used your "Preview Post" function in "NewTopic"for a-zа-яA-ZА-Яand i got same in "Post Preview" box but original code changed toa-z& # 1072;-& # 1103;A-Z& # 1040;- & # 1071;with out spaces of course Edited August 4, 2009 by es131245 Link to comment Share on other sites More sharing options...
justsomeguy Posted August 4, 2009 Report Share Posted August 4, 2009 When you use a range like this:[a-z]It checks the ASCII character set only. If you want to check for Unicode characters you need to give the character codes, not the actual characters. Examples here:http://unicode.org/reports/tr18/ Link to comment Share on other sites More sharing options...
es131245 Posted August 4, 2009 Author Report Share Posted August 4, 2009 I got some difficulties with unicodenon of those helped ƚ - ,F; U+0410-U+044F \p{Cyrillic}may anyone explain this to me? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 4, 2009 Report Share Posted August 4, 2009 It looks like you can use your character ranges as long as you use the UTF modifier. First, don't use ereg functions, they are gone as of PHP6. Use the preg functions instead. Use preg_match to match your string against the pattern, and check the modifiers reference to see how to make it case-insensitive and to turn on UTF mode:http://www.php.net/manual/en/book.pcre.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now