Fixing ñ characters in code-igniter

It seems this is one of the oldest issues of PHP develoment, right?. I’ve developed a PHP website, based on codeigniter framework (and a mysql database), and i ran into a lot of problems with the ñ, not showing up well in google.

Here’s what i’ve done to fix this problem:

  1. Set the database collation / columns to utf8_general_ci (by means of phpmyadmin).
  2. In codeigniter’s ‘config.php’ file.
    [cc lang=”php”]$config[‘charset’] = ‘UTF-8’;[/cc]
  3. In codeigniter’s ‘database.php’:
    [cc lang=”php”]$db[‘default’][‘char_set’] = ‘utf8’;
    $db[‘default’][‘dbcollat’] = ‘utf8_general_ci’;[/cc]
  4. In the ‘general’ html-rendering, before anything else gets echo’ed (beware, i’m using HTML5.. HTML4 is different):
    [cc lang=”html”][/cc]
  5. And finally… in my .htaccess file:
    [cc lang=”bash”]AddDefaultCharset UTF-8[/cc]

I hope this helps. I’ve spent many hours reading… testing… and a couple days waiting for Google’s update!.