Recess Developer Forums: Broken character encoding - Recess Developer Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Broken character encoding or why utf-8 isn't working

#1 User is offline   Daniel Icon

  • Group: Members
  • Posts: 11
  • Joined: 08-March 10

Posted 11 March 2010 - 05:11 AM

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

in my template all non-ascii characters come out as ?. If i then switch to iso-8859-15 in the browser everything is right again.

But that shouldn't be since my DB, my tables and the connection all use an utf-8 collation according to phpMyAdmin. And i suppose it has to do with the DB because writing problematic letters directly in the template files works. So does anyone have an idea why this is happening?

Where would i have to put something like:
mysql_query("SET NAMES 'utf8';", $link);
mysql_query("SET CHARACTER SET 'utf8';", $link);

for testing purposes, for example?

P.S.: Without any metatags the encoding ends up being windows-1252. But the files are on a linux server.
0

#2 User is offline   Daniel Icon

  • Group: Members
  • Posts: 11
  • Joined: 08-March 10

Posted 12 March 2010 - 05:28 AM

Ok, i found out myself. Seems like the default PDO is not using utf8. So in my recess-conf.php i added the needed driver option and was good to go. For reference:
$driver_options = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' );
RecessConf::$defaultDatabase
    = array('mysql:host=127.0.0.1;dbname=recess', 'myuser', 'mypass', $driver_options
);

0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users