yavona Posted May 7, 2010 Share Posted May 7, 2010 Hello, i'm trying to write a function for registration. But my problem is to accept turkish characters like öçişüğı. First of all, i've tried; if (ereg('[^a-z0-9]', $user)) but didn't work. than i've added turkish chars like çöiüğşı adter [a-z] but didn't worked. than i've worked on mb_ereg, mb_regex_encoding("UTF-8") but didn't worked again. at the end i've this code; mb_regex_encoding("UTF-8"); if(!mb_ereg("[a-z]",$_POST['user'])) { echo "false"; } else { echo "true"; } when i write "öçiğüı" in input it accepted the turkish chars, when i write forbidden chars "}][{{½' , it didn't accept as i wanted to be. but when i write "test}][{{½" it accepted ) and i'm still crying since that second. At the end, i've a problem about accepting utf-8 chars with ereg .. Any idea or code sample do you have for this problem? thanks to all Link to comment https://forums.phpfreaks.com/topic/201007-ereg-usage-for-foreign-language/ Share on other sites More sharing options...
cags Posted May 7, 2010 Share Posted May 7, 2010 ereg should ideally be avoided, use the PCRE preg_ functions instead such as preg_match. You may well need to use the u modifier to match those characters. Link to comment https://forums.phpfreaks.com/topic/201007-ereg-usage-for-foreign-language/#findComment-1054630 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.