We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Changing charset. Accentuation error. Help

I am trying to use phalcon with iso-8859-1 but all of my accentuation are replaced by ? Example:

I write : "gestão" and in view the browser shows: gest�o

What can I do?



98.9k

Try setting the charset in your connection up:

$di["db"] = function() {
    return new \Phalcon\Db\Adapter\Pdo\Mysql(array(
        "host" => "localhost",
        "username" => "root",
        "password" => "1234",
        "dbname" => "test",
        "options" => array(
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
        )
    ));
};

Also here:



726

It didnt solve my problem. This data is not my data base. It is in a .volt view page

edited Aug '14

Try to add to your .htaccess:

AddDefaultCharset iso-8859-1


91
edited Mar '15

I have the same problem. Server - nginx. Solved the problem by forcing the content type.

$this-> response-> setContentType ('text / html', 'iso-8859-1');

In controllers or index.php