Monday, September 14, 2015

Re: 3.1-rc1 utf-8 special chars problem

In HTML5 a browser will use HTTP header first, then BOM and finally HTML meta to set encoding.

So check for missing <meta charset="utf-8"/> in HTML head.
Add HTTP header e.g. in httpd.conf or .htaccess: AddDefaultCharset utf-8
or save files in "utf-8 without BOM" encoding.

On Monday, September 14, 2015 at 11:46:18 AM UTC+2, Salines wrote:
During the migration from 2.6 to 3.1 may encounter problems with the display of special characters  in the Croatian language, the content is taken from the database.

Content is stored in a database via CakePHP 2.x applications, and can be displayed properly. but when I connect a new application I have a problem with the proper display of these characters čćšđž.


database / tables :  MyISAM utf8_general_ci

cakephp 2.x app

public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => '*********',
'password' => '************',
'database' => 'apartmani',
);

core.php

/**
 * Application wide charset encoding
 */
Configure::write('App.encoding', 'UTF-8');


bootstrap.php

Configure::write('Config.language', 'hrv');


cakephp 3.1- rc1

'App' => [
        'namespace' => 'App',
        'encoding' => 'UTF-8',
...

'Datasources' => [
        'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost',
            /**
             * CakePHP will use the default DB port based on the driver selected
             * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
             * the following line and set the port accordingly
             */
            //'port' => 'nonstandard_port_number',
            'username' => '*********',
            'password' => '***********',
            'database' => 'apartmani',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'cacheMetadata' => true,

bootstap.php

/**
 * Set the default locale. This controls how dates, number and currency is
 * formatted and sets the default language to use for translations.
 */
ini_set('intl.default_locale', 'hr');



How to fix this?

Thanks

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: