[Tickets #8777] Re: $conf['sql']['charset'] is ignored

bugs at horde.org bugs at horde.org
Sun Feb 7 06:22:27 UTC 2010


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8777
------------------------------------------------------------------------------
  Ticket             | 8777
  Updated By         | lfbm.andamentos at gmail.com
  Summary            | $conf['sql']['charset'] is ignored
  Queue              | Horde Base
  Version            | 3.3.5
  Type               | Bug
  State              | Not A Bug
  Priority           | 1. Low
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


lfbm.andamentos at gmail.com (2010-02-07 01:22) wrote:

> I'm telling you that the code that did this right before is doing it  
> wrong now because it relays on PEAR functionality that isn't there  
> anymore.
>
> Understand ?
>
> And this make this problem a Horde BUG!

Hello:

I think Horde is doing the work just fine. You can check it by  
manually echoing the result of, for example, convertToDriver method  
from kronolith/lib/Driver/sql.php. You'll see that the text is  
converted just fine.

What seems to be happening wrong is, for some reason I don't know,  
mysql connection always defaults it's charset to 'latin1' (even if the  
charset is set to utf8 in my.cnf in charset_set_server and  
default_charset_set) and then the text with "special" characters,  
which was converted fine at the php layer, is wrongly recorded into  
the database as 'latin1', and thus the problem of unusable data saved.

I managed to solve this issue by adding:

[mysqld]
init_connect="SET NAMES 'utf8'"

and restarting mysqld. Now the text is just the same on horde and on  
the db, which makes it good to be used from other tools (import/export  
etc.).

Also, the mysql_set_charset function only works for PHP 5 >= 5.2.3. So  
the workaround of editing PEAR's DB may no apply to all installs.

See if the init_connect option in my.cnf works for you. Hope it helps.






More information about the bugs mailing list