Welcome Guest, Not a member yet? Register   Sign In
Form validation with special characters like accents
#1

[eluser]ckelly06[/eluser]
Hey guys,

I just spent the last half hour scouring Stackoverflow, this forum (which has this question posted several times but no solutions that worked for me) and Google but haven't had any luck. I simply need my form to accept accented characters like "é" when I use the alpha_dash validation function. I found one solution that said to do it this way:

Code:
$str = utf8_encode($str);
return ( ! preg_match("/^([\p{L}a-zA-Z0-9]*)$/i", $str)) ? FALSE : TRUE;

But it's not working. Does this have to do with not properly encoding my page in UTF-8? I have this in the <head> section...

Code:
<meta http-equiv="content-type" c />

and this in .htaccess

Code:
AddDefaultCharset UTF-8

because I read a couple articles saying to do that. Still no luck. How do I fix this problem?

Thanks in advance!
#2

[eluser]ckelly06[/eluser]
For some reason putting my <meta> tag in the forum's code brackets messes it up, but there's what it looks like:

meta http-equiv="content-type" content="text/html;charset=utf-8"




Theme © iAndrew 2016 - Forum software by © MyBB