D
D
Denis Goncharenko2015-10-13 17:39:34
Character encoding
Denis Goncharenko, 2015-10-13 17:39:34

Phalcon, what's wrong with the encoding?

Some kind of idiotic problem, the Cyrillic alphabet is corny not displayed correctly.
Controller out of the box:

class IndexController extends ControllerBase
{

    public function indexAction()
    {
        echo "Пользователя с таким логином не существует";
    }

}

In php.ini:
default_charset = "UTF-8"
In default template:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

In the config (although the database has nothing to do with it, but anyway, the database itself is also in UTF-8):
return new \Phalcon\Config(array(
    'database' => array(
        'adapter'     => 'Mysql',
        'host'        => 'localhost',
        'username'    => 'root',
        'password'    => '',
        'dbname'      => 'ms_main',
        'charset'     => 'utf8',
    ),
    'application' => array(
        'controllersDir' => APP_PATH . '/app/controllers/',
        'modelsDir'      => APP_PATH . '/app/models/',
        'migrationsDir'  => APP_PATH . '/app/migrations/',
        'viewsDir'       => APP_PATH . '/app/views/',
        'pluginsDir'     => APP_PATH . '/app/plugins/',
        'libraryDir'     => APP_PATH . '/app/library/',
        'cacheDir'       => APP_PATH . '/app/cache/',
        'baseUri'        => '',
    )
));

As a result in the browser:
...
<body>
        ������������ � ����� ������� �� ����������    
</body>
...

With Latin, everything is fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
KorsaR-ZN, 2015-10-17
@denis79513

What encoding are your .php files in?
They need to be recoded to "utf8 without BOM"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question