Friday, July 6, 2012

Re: How do I get some fields to display as Greek, some as Hebrew (most as English)?

You need to ensure that all parts of the application are using the
same character encoding. UTF-8 is a good choice.

When you create the database specify the encoding. For MySQL:

CREATE DATABASE foo DEFAULT CHARACTER SET utf8;

If you've populated the DB with a file full of data, first make sure
that the file uses UTF-8. On a linux box:

file --mime-encoding foo.sql

Next include these two lines at the top of your import file to tell
the DB how to treat the text:

SET NAMES 'utf8';
SET CHARACTER SET 'utf8';

Then you need to include the following in database.php so that when
Cake connects it tells the DB to respond with the correct encoding:

'encoding' => 'utf8'

In core.php:

Configure::write('App.encoding', 'UTF-8');

In your layout(s):

<?= $this->Html->charset() ?>

The latter will include this in the head:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

... which tells the browser how to treat the content.

On Thu, Jul 5, 2012 at 11:01 PM, Kevin Mitchell <kevin@ncbible.com> wrote:
> I am new to CakePHP, having just learned how to bake a table to create
> Model, Controller, and View. One of the fields in my database is Hebrew
> (with diacritics) and one is Greek; the remainder of the fields are English.
> How do I get the Hebrew and Greek to show up correctly? As is, I just see a
> bunch of question marks, e.g.: ????? ???.
>
> Thank you, so very much, for you expertise and time.
>
> Kevin
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: