Welcome Guest, Not a member yet? Register   Sign In
Experiencing a problem with UTF-8 and diacritics (characters with accents, etc.)
#6

[eluser]tinawina[/eluser]
Hold the phone - I got it to work. I ran utf8_decode() on the input and then ran it through my diacritics clean up script and it's doing what I need it to do:

Code:
$input = utf8_decode($this->input->post('title')); // Not sure why I would need to decode here, but this fixes it!
  
$search = explode(",","À,È,Ì,Ò,Ù,à,è,ì,ò,ù,Á,É,Í,Ó,Ú,Ý,á,é,í,ó,ú,ý,Â,Ê,Î,Ô,Û,â,ê,î,ô,û,Ã,Ñ,Õ,ã,ñ,õ,Ä,Ë,Ï,Ö,Ü,Ÿ,ä,ë,ï,ö,ü,ÿ");
$replace = explode(",","À,È,Ì,Ò,Ù,à,è,ì,ò,ù,Á,É,Í,Ó,Ú,Ý,á,é,í,ó,ú,ý,Â,Ê,Î,Ô,Û,â,ê,î,ô,û,Ã,Ntilde;,Õ,ã,ñ,õ,Ä,Ë,Ï,Ö,Ü,Ÿ,ä,ë,ï,ö,ü,ÿ");
$new_input = str_replace($search, $replace, $input);
  
echo  $new_input; // $this->input->post('title')

I input "son sobresalientes sólo existía un puñado" -- IN IE -- and got back this as the source code which is correct:

Code:
años son sobresalientes sólo existía un puñado

So - I guess that does it. Hopefully!


Messages In This Thread
Experiencing a problem with UTF-8 and diacritics (characters with accents, etc.) - by El Forum - 03-22-2012, 09:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB