Jump to content

ereg() usage for foreign language?


yavona

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.