One for the gurus: upgrade to 3.x messed up only filenames with accented chars

Maybe you should consider option C).
Convert all accented characters to normal UTF-8 characters.
So EXPRESSÃO.jpg -> EXPRESSAO.jpg

I think this would help you a lot, not only when it come sto coding and file systems, but also storing names / references in databases.

Update

This is a function I use for removing accents. I found this solution somewhere on the web.

  function sanitizeName($name)
  {
      $pattern = array("'é'", "'è'", "'ë'", "'ê'", "'É'", "'È'", "'Ë'", "'Ê'", "'á'", "'à'", "'ä'", "'â'", "'å'", "'Á'", "'À'", "'Ä'", "'Â'", "'Å'", "'ó'", "'ò'", "'ö'", "'ô'", "'Ó'", "'Ò'", "'Ö'", "'Ô'", "'í'", "'ì'", "'ï'", "'î'", "'Í'", "'Ì'", "'Ï'", "'Î'", "'ú'", "'ù'", "'ü'", "'û'", "'Ú'", "'Ù'", "'Ü'", "'Û'", "'ý'", "'ÿ'", "'Ý'", "'ø'", "'Ø'", "'œ'", "'Œ'", "'Æ'", "'ç'", "'Ç'");
      $replace = array('e', 'e', 'e', 'e', 'E', 'E', 'E', 'E', 'a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A', 'A', 'o', 'o', 'o', 'o', 'O', 'O', 'O', 'O', 'i', 'i', 'i', 'I', 'I', 'I', 'I', 'I', 'u', 'u', 'u', 'u', 'U', 'U', 'U', 'U', 'y', 'y', 'Y', 'o', 'O', 'a', 'A', 'A', 'c', 'C');        

      $name = preg_replace($pattern, $replace, $name);      
      return $name;
  }

So maybe you can read all files, clean the names using this function, and save the files with new name.

In the end, I gave up accents and I now convert all accents to HTML equvalant.So Abaeté; is stored as Abaeté in my DB.

Leave a Comment