es131245 Posted August 4, 2009 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 Share Posted August 4, 2009 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. Link to comment Share on other sites More sharing options...
es131245 Posted August 4, 2009 Author 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 Link to comment Share on other sites More sharing options...
Ingolme Posted August 4, 2009 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 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 Share Posted August 4, 2009 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 Link to comment Share on other sites More sharing options...
justsomeguy Posted August 4, 2009 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 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 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
Archived
This topic is now archived and is closed to further replies.