Development

#203 (MySQL connection encoding)

You must first sign up to be able to contribute.

Ticket #203 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

MySQL connection encoding

Reported by: l2k <symfony-trac@cny.de> Assigned to:
Priority: major Milestone: 1.0.0
Component: Version: 0.7.X
Keywords: utf-8 unicode mysql Cc:
Qualification:

Description

Several people—including me—have problems with UTF8 databases. The connection between PHP and MySQL often doesn’t use the right character set, which results in data being double encoded in the database. Not good.

One soulution is to have the line init-connect = "SET NAMES utf8; SET CHARACTER SET utf8;" in your mysql.conf file. But that has undesirable side effects on other applications.

So symfony should provide some way to do a init-connect on application level by adding some lines in the database configuration. (Or is this maybe a propel issue and should be implemented on their end?)

Change History

02/12/06 12:50:02 changed by fabien

If propel has a configuration option, we can add this to the databases.yml.

02/16/06 15:14:02 changed by t.kroha@seto-gmbh.de

there is a propel option.

but setting this propel.database.encoding = utf-8 in propel.ini

still returns 'latin1' for print mysql_client_encoding ();

02/17/06 00:20:12 changed by RoVeRT <symfony@rovert.net>

propel.ini settions are build time only and conversions to/from charset are done with iconv

02/26/06 18:19:53 changed by fabien

  • status changed from new to closed.
  • resolution set to invalid.

I close this bug since it is more a Propel issue than a symfony one.

04/12/06 14:01:07 changed by anonymous

  • status changed from closed to reopened.
  • resolution deleted.

Following the discussion on this post, reopened this ticket. It would really be great to have a workaround in symfony. I consider this issue is quite serious as data is corrupted in the database if certain standard system configurations are met.

04/19/06 14:22:26 changed by fabien

  • status changed from reopened to closed.
  • resolution set to invalid.

It is a creole issue. There is nothing I can do in symfony.

http://creole.phpdb.org/trac/ticket/13

Please, talk to the creole devs.

08/20/06 16:55:42 changed by l2k

Pointer: A workaround can be found here: http://www.symfony-project.com/snippets/snippet/37

09/20/06 22:25:42 changed by l2k

  • status changed from closed to reopened.
  • version changed from 0.6.0 to 0.7.X.
  • resolution deleted.

Yesterday Creole 1.1.0 with encoding support for mysql has been released.

It would be nice to have this option added to databases.yml now.

See http://creole.phpdb.org/trac/changeset/48

09/21/06 09:46:30 changed by fabien

  • milestone set to 1.0.0.

09/21/06 09:48:25 changed by fabien

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [2136]) added encoding parameter to database.yml (closes #203, #944)

09/25/06 09:58:03 changed by epaulin

  • status changed from closed to reopened.
  • resolution deleted.

encoding parameter did't set before, so always null;

epaulin@yinhm:symfony$svn diff lib/database/sfPropelDatabase.class.php
Index: lib/database/sfPropelDatabase.class.php
===================================================================
--- lib/database/sfPropelDatabase.class.php     (revision 2161)
+++ lib/database/sfPropelDatabase.class.php     (working copy)
@@ -70,6 +70,7 @@
       $this->setParameter('username', $params['username']);
       $this->setParameter('password', $params['password']);
       $this->setParameter('port',     $params['port']);
+      $this->setParameter('encoding',  $params['encoding']);
     }

     self::$config['propel']['datasources'][$this->getParameter('datasource')] =

09/25/06 16:31:03 changed by fabien

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [2172]) fixed MySQL connection encoding (closes #203 - patch from epaulin)