Thanks for your replies.
Apparently this sees to have been the problem:

When the nothing was done at all to the charsets you could have stuff
working ok since whenever garbled characters were saved they would
ungarble when they were read out again. Tables were utf8 but not MySQl
itself.

Setting MySQL to utf8 (for a big import from a textfile in utf8)
started the trouble i think. Now MySQL was all utf8 but the connection
to php was confused and MySQL converted all incoming text to utf8.
This led to the doubble encoding.

Setting "encoding" to utf8 in CakePHPs config/database.php got php to
force utf8 when connecting and MySQL stopped encoding text.


The moral of the story is to leave everything along or make real sure
that absolutely everything gets reset to your "new" encoding.
The thing that threw me was that test imported info MySQL with proper
utf8 characters would give strange and very very bad result when
selecting. selecting "halla" would find both rows with "halla" and
"hallå". Umlaut characters would be interpreted as if they did not
have their dots and things. This caused a world of problems since user
names were not unique anymore when searching the database.

What I learned from that was that MySQL can ignore table-collation and
table charsets. I had to alter my tables and modify all varchar fields
to include charset and collation settings.

I have never had this much trouble with charsets before... :)

/Martin
On Jun 12, 10:17 am, leo <[EMAIL PROTECTED]> wrote:
> I'm inclined to agree. I had the same problem. All my MySql
> installations default to Swedish, so need to be converted. Have a look
> at this 
> page:http://ragrawal.wordpress.com/2008/02/15/dummys-guide-for-converting-...
>
> Be aware that MySql is 'utf8' whereas everything else is utf-8 or
> UTF-8. I don't know how important the case is.
>
> On Jun 12, 9:06 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>
> > I'd say it's the other way around.
> > Text gets stored in some non-UTF8 format in the database (latin-1 most  
> > likely), so it comes back as gobbledygook. When you explicitly force  
> > the gobbledygook to be interpreted as UTF8, it's being morphed back  
> > into what it was meant to be.
>
> > Check your database settings and set all collations to UTF8.
>
> > On 12 Jun 2008, at 15:58, [EMAIL PROTECTED] wrote:
>
> > > Hi,
> > > I have started putting a project onto a rented "production server"
> > > running a pretty standard Ubuntu installation AFAIK.
> > > I have been able to fix some initial problems with charsets but one
> > > thing I just can seem to figure out.
>
> > > On my dev system
> > > $this->params['form']['hello_text'] // in MySQL = hallå
>
> > > On production system
> > > $this->params['form']['hello_text'] // inMySQL = hallå
> > > utf8_decode( $this->params['form']['hello_text'] ) // inMySQL = hallå
>
> > > Looks like the text gets encoded to utf8 before being put into the
> > > database. Problem is that the text is already utf8 so I get these
> > > nasty characters.
>
> > > Does anyone know what triggers Cake or PHP to encode the text before
> > > sending it to MySQL?
>
> > > Any pointer in the right direction would be great. thanks.
>
> > > Martin
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to