Thursday, October 30, 2008

Re: Problem with encoding when upgrading to 1.1.20

There is a central application-wide encoding setting in config/
core.php. Make sure you have not forgotten that one.
Another basic check is to look at the layout and see what charset is
set in the header. (just to make sure)

One problem I have seen is that you may think that your old data is in
utf-8 when it in fact is not. Possibly the old application connected
to the database using latin1 or something despite your efforts. This
has happened to me in the past and is not too hard to fix if you can
take the database offline for a few minutes.

If you connect to the database (console client) and make sure you are
using utf8 for the connection ("set names utf8" at least for mysql)
you can select some data and see if it is displayed correctly in the
console. If it is not then your data is inserted as something else
(probably standard latin1).

If you find that your data is in fact not stored correctly you need to
figure out which fields in which tables need converting. That can be
the tiresome bit. Start with one field in one table and do some tests
with the following queries. The order you put them in and the charsets
you select will determine the results.

I have put some sample data on my website. If you find this is your
problem , you can check it out:
http://pensive.eimermusic.com/remember/fixing-existing-data-when-switching-character-set-in-mysql

/Martin

On Oct 30, 9:21 am, Sjurl <sjur.ringheim....@imr.no> wrote:
> Hello,
>
> The application im developing has just upgraded from CakePHP 1.1.11 to
> 1.1.20 and that somehow broke the encoding of the data we show the
> user from the database. When i changed back to 1.1.11 (changing the
> cake folder) it all worked as intended again.
>
> Im trying to use UTF-8 but the page is rendered in ISO-8859-1.
>
> The database encoding is UTF-8 and i have put the right meta tag in
> the main thtml file and allso put in 'encoding' => 'UTF8' in the
> connection to the database. We are using Postgresql and all the tips i
> so far have found on fixing this problem seems to be with users using
> MySQL so im not realy sure if the things i have tried to do are able
> to fix my problem.
>
> Is there anyone who knows where i ought to look to fix this problem,
> or what might be causing it? It seems that it is something in the core
> library that has changed between these two builds that are causing it.
>
> Best regards
> Sjur
--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: