Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UTF-8 output with CakePHP

I'm trying to move some Excel-Data to MySQL, but having troubles with encoding.

What I did:

  1. Data export from OpenOffice 3.1 as csv (utf-8 encoded)
  2. Import to phpMyAdmin via file upload (Table encoding: 'utf8_unicode_ci')

In phpMyAdmin's view mode, the data is displayed correctly (it is using utf-8 as charset):

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

When I try to display the Data on my webpage, I get a hash with a question mark in it.

System-Info

  • The language I try to get on my page: German
  • MySQL client version: 5.0.32
  • My OS: MAC OS X 10.5.7
  • Server-Script: CakePHP v1.2.3.8166

Regards, Benedikt

like image 502
Benedikt Avatar asked Jul 28 '09 19:07

Benedikt


1 Answers

I had a similar symptom, my solution was to add

'encoding' => 'UTF8' 

to config/database.php

like image 132
sibidiba Avatar answered Oct 13 '22 21:10

sibidiba