dracoblue.net

UTF-8 connections with Propel in Agavi

If you want to override the propel configurations for charset (encoding) for the connection you usally set the settings['charset'] value to for example utf8.

But if you are using agavi you want to configure propel properly by using agavi's databases.xml.

So after trying a while, here is how you can set the charset (magic is

bold):

<?xml version="1.0" encoding="UTF-8"?>
&lt;ae:configurations
  xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0"
  xmlns="http://agavi.org/agavi/config/parts/databases/1.0">
  &lt;ae:configuration>
    &lt;databases default="propel">
      &lt;database name="propel"
        class="AgaviPropelDatabase">
        &lt;ae:parameter name="config">%core.app_dir%/config/propelproject-conf.php&lt;/ae:parameter>
        &lt;ae:parameter name="overrides">
          &lt;ae:parameter name="connection">
            &lt;ae:parameter name="dsn">mysql:dbname=icanhazagavirelease;host=127.0.0.1&lt;/ae:parameter>
            &lt;ae:parameter name="user">w00t&lt;/ae:parameter>
            &lt;ae:parameter name="password">not_default_pass&lt;/ae:parameter>
            [strong]&lt;ae:parameter name="settings">
              &lt;ae:parameter name="charset">
                &lt;ae:parameter name="value">utf8&lt;/ae:parameter>
              &lt;/ae:parameter>
            &lt;/ae:parameter>[/strong]
          &lt;/ae:parameter>
        &lt;/ae:parameter>      
      &lt;/database>
    &lt;/databases>
  &lt;/ae:configuration>
&lt;/ae:configurations>
In agavi, open source, php, propel by
@ 18 Feb 2009, Comments at Reddit & Hackernews

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files

About