Jump to content

Php + Russian Alphabet


es131245

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.

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

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
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...