Jorge
Jorge

Reputation: 674

Non-English characters in CakePHP

I'm having a problem with CakePHP. My application is not echoing out any non-English character(ñ,á,é). I'm not having that problem with raw PHP but the framework seems to be working odd about the encoding. I've already tried putting this line in the header of the layout files but it keeps failing: <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
Hope you guys can help me out. Thank you.

Upvotes: 0

Views: 1024

Answers (3)

didiFaridi
didiFaridi

Reputation: 471

make sure that your database configuration has the encoding enabled.

public $default = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'root',
        'password' => '',
        'database' => 'XXX',
        'prefix' => 'XXX_',
        'encoding' => 'utf8',
    );

Upvotes: 0

Kieran Dang
Kieran Dang

Reputation: 447

Make sure you have saved your file with UTF-8 encoding.

Upvotes: 1

Jakob Alexander Eichler
Jakob Alexander Eichler

Reputation: 3056

Where do you get your data from? You have to set the correct encoding (utf8?) for your database connection. If you get input from other sources you can use iconv to convert the data to utf8.

http://php.net/manual/de/book.iconv.php

But be aware, that you should know the encoding of your input data, otherwise it is hard or almost impossible to figure your source charset out.

Upvotes: 0

Related Questions