logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$5
Why would I get garbage character if everything is encoded UTF8?

I have a German name with an umlaut.

The database is MySql. It has a UTF8 character collation.

If I look at the character in phpMyAdmin, it looks correct.

If I look at the character in the terminal, using the mysql command line client, the character looks correct.

When it shows up on my website, it is a garbage character.

The encoding of the page is UTF8.

Where might something go wrong that this character would mis-render?

UPDATE:

I'm making this custom call in one of my peer classes:

class GermanPhotosPeer extends BaseGermanPhotosPeer
{
static function getActiveSlides()
{

$c = new Criteria();
$c->add(GermanPhotosPeer::ACTIVE, 'Y');
//$c->add(GermanPhotos::REFERENCE_DATE, date(),Criteria::LESS_EQUAL);
$c->addAscendingOrderByColumn(GermanPhotosPeer::SORT_NUMBER);
$rows = GermanPhotosPeer::doSelect( $c );

return($rows);
}
}


What config files govern this?

This question has been answered.

marshall | 06/18/10 at 1:04pm Edit


(7) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    06/18/10
    1:09pm
    Arturo Linares says:

    Add this meta:

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

  • avatar
    Last edited:
    06/18/10
    2:29pm
    michalg says:

    Hello,

    1) Do you have UTF 8 as your client encoding in databases.yml?
    http://www.symfony-project.org/reference/1_4/en/07-Databases#chapter_07_propel

    2) Can you show any utf8 characters on your site? Make a test:
    - add some variable in action with utf8 text
    - echo it in view

  • avatar
    Last edited:
    06/19/10
    1:15pm
    Bill Hunt says:

    What version of symfony & doctrine are you running? In symfony < 1.3 / doctrine < 1.2, you needed to set the character encoding manually:

    http://blog.marcw.net/tips/utf-8-on-all-your-tables-with-doctrine-and-symfony-1-2/

    Versions after that you can set them in your databases.yml:


    all:
    foo:
    class: sfDoctrineDatabase
    param:
    dsn: mysql://admin:password@localhost/foo
    attributes:
    default_table_charset: utf8
    default_table_collate: utf8_general_ci


    Other things to check would include your mysql my.ini file to make sure that your database charset and default charset are set to utf8

  • avatar
    Last edited:
    06/18/10
    9:11pm
    Martin Palacio says:

    Are your php files saved with utf-8 encoding? How do the garbage characters look like? It's a question mark?

    Option 2: Check the collation of:
    * mysql default collation for client connections
    * database default collation
    * table default collation
    * field collation

  • avatar
    Last edited:
    06/18/10
    11:38pm
    GlobalOrangeLab says:

    UTF-8 is the default encoding used by symfony, Even you can check with following setting.

    apps/frontend/config/settings.yml
    all:
    .settings:
    charset: utf-8


    2) Check Following
    -> Mysql default collation
    -> database, table and filed collation

    Hope this helps!

  • avatar
    Last edited:
    06/18/10
    1:20pm
    marshall says:

    We already have this on the web site:


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

  • avatar
    Last edited:
    06/18/10
    1:31pm
    Arturo Linares says:

    what happens if you htmlentities() the string? or utf8_encode/utf8_decode?

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.