Re: Listing menu items from database to layout file
On Sat, Dec 8, 2012 at 4:50 AM, Trisztán Thar <trisztan94@gmail.com> wrote:
>
> lowpass:
> Actually, I did, and it has problems with my non-english characters, it
> doesn't display them.. Maybe server configuration? I'm using EasyPHP as my
> server.
There are a number of stages where character encoding can cause
problems. You need to ensure that each piece of software is configured
properly. It's similar to colour management in that regard. Even
sending files to the server via FTP can be problematic.
You didn't mention which OS you're using; if it's Windows I can't help
much. I'm assuming you want UTF-8 encoding, as it's the most useful
and the default in most software these days.
First, check your editor. Make sure it's saving as UTF-8. If possible,
check to see that it recognises the file as UTF-8 when you open it.
If you're using Linux or OS X you can run this in a terminal to see
what the encoding actually is:
file -bi your_file
Check the database. MySQL still uses Latin1 by default for some
bizarre reason. When you create the database and tables, always
include the character encoding you want if any of the columns will
contain text.
To see what your existing DB is configured as, log into MySQL and type:
SHOW FULL COLUMNS FROM your_table;
Note what the Collation is for the column with the text you're seeing
problems with.
Also, if you import data into MySQL, always place this at the top of the file:
SET NAMES 'utf8';
SET CHARACTER SET 'utf8';
Next, check Cake. It uses UTF-8 by default. Check that the
App.encoding in app/core.php is correct.
If you can, check that your webserver is behaving properly. In Apache:
AddDefaultCharset utf-8
Check the response headers for the page. There are many ways to do
this. Firebug's Net panel, for example. You should see:
Content-Type text/html; charset=UTF-8
In your layouts, include this in the head section:
echo $this->Html->charset();
This should create:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
View source to be sure.
--
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home