I have a php/html application over a MySql database. Database encoding is UTF-8 and so are HTML files (<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> and <meta charset="utf-8">).
The thing is, there is inconsistency, as in a list page (plain html, no forms), I can see UTF-8 characters properly ( ), and also when I select values in mysql admin, but in the edit form I see wrong characters (
), and also when I select values in mysql admin, but in the edit form I see wrong characters ( ) inside input text fields. This happens when I update a value inside mysql admin.
) inside input text fields. This happens when I update a value inside mysql admin.
And the inverse occurs, if I update a value through the form I see characters properly inside input text field, but wrong in list (html, no forms) ( ).
).
As I read the problem may be in the files encoding, which is confusing, as, if I list with file -i (I use linux) I see a mixture of utf-8 and us-ascii files, but if I open then with sublime text 3, I can see UTF-8 on all of them, and even if i save with encoding utf-8, file -i doesn't change result.
I also read that file -i is more a guess than a real result, so I'm quite puzzled in which encoding files have, how can I change them for real. There are many files involved, templates, libraries, etc.
EDIT:
To connect to database, I use Doctrine (which I ignore internal mechanisms) and also @mysql_connect, which I force with $this->charset_utf8 = true
SOLUTION
Not really a duplicate of UTF-8 all the way through, but @deceze is right, I needed to configure Doctrine connection as explained in this SO response:
$connectionOptions = array(
    'driver'   => $options['conn']['driv'],
    'user'     => $options['conn']['user'],
    'password' => $options['conn']['pass'],
    'dbname'   => $options['conn']['dbname'],
    'host'     => $options['conn']['host'],
    'charset'  => 'utf8',
    'driverOptions' => array(
    1002 => 'SET NAMES utf8'
    )
);
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
Thank you
 
    