To add the connection flag add the following line to your database yml
all:
propel:
class: sfPropelDatabase
param:
phptype: mysql
host: localhost
database: xxxxxx
username: xxxxxxxxxx
password: xxxxxxx
compat_assoc_lower: true
datasource: propel
encoding: utf8
persistent: true
Alistair
On 09/01/2008, Alistair Stead <[EMAIL PROTECTED]> wrote:
>
> Two things to check...
>
> Have you connected to the database with a UTF-8 connection flag.... This
> used to be a bug with creole but I believe that has been resolved for some
> time...
>
>
> Also your columns will also need to be set to UTF char set... not just the
> tables.
>
>
> symfony out of the box usually works with multi-byte chars. I would start
> looking at the database first and be careful if you are exporting date to
> re-import to the database.
>
>
> Alistair
>
> On 09/01/2008, Peter HO <[EMAIL PROTECTED] > wrote:
> >
> > Hi list,
> >
> > I have a funny problem with Peer Objects and UTF-8 encoded databases.
> >
> > Here is a sample of my database :
> >
> > CREATE DATABASE `poptract` DEFAULT CHARACTER SET utf8 COLLATE
> > utf8_unicode_ci;
> > USE `poptract`;
> >
> > CREATE TABLE `projets` (
> > `idProjet` bigint(20) NOT NULL AUTO_INCREMENT,
> > `libelle` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT
> > NULL,
> > `dateDebut` date DEFAULT NULL,
> > `statut` smallint(6) DEFAULT NULL,
> > `dateFin` date DEFAULT NULL,
> > `idClient` bigint(20) DEFAULT NULL,
> > `baseNom` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT
> > NULL,
> > `dateCreation` date DEFAULT NULL,
> > PRIMARY KEY (`idProjet`),
> > KEY `WDIDX11986616292` (`libelle`),
> > KEY `WDIDX11986616293` (`idClient`)
> > ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 AUTO_INCREMENT=12 ;
> >
> >
> >
> > All my files are UTF-8 encoded, I have added
> >
> > charset: utf-8
> >
> > in my settings.yml,
> >
> > charset: UTF-8
> >
> > in view.yml's metas section,
> >
> >
> > param:
> > encoding: utf8
> >
> > in databases.yml.
> >
> > And now the funny part :
> > In my action :
> >
> > $this->projets = ProjetsPeer::retrieveByPK(11);
> >
> >
> > In my view :
> >
> > var_dump($projets)
> > returns me :
> > object(Projets)#97 (14) {
> > ["idprojet:protected"]=>
> > string(2) "11"
> > ["libelle:protected"]=>
> > string(16) "é a a a test è"
> > ["datecreation:protected"]=>
> > NULL
> > ["datedebut:protected"]=>
> > NULL
> > ["statut:protected"]=>
> > NULL
> > ["datefin:protected"]=>
> > NULL
> > ["idclient:protected"]=>
> > string(1) "1"
> > ["basenom:protected"]=>
> > string(6) "blabla"
> > ["alreadyInSave:protected"]=>
> > bool(false)
> > ["alreadyInValidation:protected"]=>
> > bool(false)
> > ["validationFailures:protected"]=>
> > array(0) {
> > }
> > ["_new:private"]=>
> > bool(false)
> > ["_deleted:private"]=>
> > bool(false)
> > ["modifiedColumns:protected"]=>
> > array(0) {
> > }
> > }
> >
> >
> >
> > when
> >
> > echo $projet->getLibelle()
> > gives me
> > Ã(c) a a a test è <== see these characters ?
> >
> >
> >
> > Any Ideas ?
> >
> > Peter
> >
> > P.S. : I have the same result with PHP 5.1.2 / Apache 2.2.0 / MySQL
> > 5.0.20 / Symfony 1.0.10 / Win XP Pro SP2 and with gentoo 2.6.19 / PHP
> > 5.2.2-pl1-gentoo / Mysql 5.0.26 / Symfony 1.0.6 / Apache 2.0.58
> >
> > > >
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---