Jump to content

Php + Russian Alphabet


es131245
 Share

Recommended Posts

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

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 by Ingolme
Link to comment
Share on other sites

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 by es131245
Link to comment
Share on other sites

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

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

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 to
a-z& # 1072;-& # 1103;A-Z& # 1040;- & # 1071;
with out spaces of course Edited by es131245
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...