• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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"


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.