<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Connecting the dots... &#187; utf-8</title>
	<atom:link href="http://blog.rajatpandit.com/tag/utf-8/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rajatpandit.com</link>
	<description>Thoughts on Web Development, Infrastructure and Application Scalability</description>
	<lastBuildDate>Thu, 29 Dec 2011 13:21:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Creating utf-8 tables in symfony 1.4 /doctrine 1.2</title>
		<link>http://blog.rajatpandit.com/2009/12/19/creating-utf-8-tables-in-symfony-1-4-doctrine-1-2/</link>
		<comments>http://blog.rajatpandit.com/2009/12/19/creating-utf-8-tables-in-symfony-1-4-doctrine-1-2/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 00:35:32 +0000</pubDate>
		<dc:creator>rp</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://blog.rajatpandit.com/?p=421</guid>
		<description><![CDATA[Recently I had an issue on one of my work websites where the database schema was setup in Latin-1 encoding, this was fine till the encoding of the website was...]]></description>
			<content:encoded><![CDATA[<p>Recently I had an issue on one of my work websites where the database schema was setup in Latin-1 encoding, this was fine till the encoding of the website was also set to iso-8859-1 and nothing fancy was going on. However later in the last few months, I had been doing some development which required me to change the encoding to utf-8 and that resulted in a lot of issues. Some I am still resolving. One of the two solutions that we came up was assign it a custom function for &#8216;escaping_strategy&#8217;, which however wasn&#8217;t the silver bullet to fix as there was more crazy code that was getting raw value from the model and hence our function would get by passed. I am still looking for better ways of fixing it (seems very likely a case of massive re-factoring required) however, this one tip was handy.</p>
<p>If you want to create an individual table to be utf-8 then in the schema.yml you can add.</p>
<pre class="brush: bash; title: ; notranslate">
User:
  options:
    type: MyISAM
    collate: utf8_unicode_ci
    charset: utf8
  columns:
    username: string(255)
    password: string(255)
</pre>
<p>However this can be a painful repetitive task, especially if you have loads and loads of tables to work with. In case you are like me and prefer all your tables to be utf-8 by default, you can add this function to your ProjectConfiguration.class.php file.</p>
<pre class="brush: php; title: ; notranslate">
  public function configureDoctrine(Doctrine_Manager $manager)
  {
    $manager-&gt;setCollate('utf8_unicode_ci');
    $manager-&gt;setCharset('utf8');
  }
</pre>
<p>and then rebuild all the models (and possibly load your fixtures if you have any.</p>
<pre class="brush: bash; title: ; notranslate">
# symfony doctrine:build --all --and-load --env=dev --no-confirmation
</pre>
<p>Obviously bare in mind that this will drop your database and re-create the tables with utf-8 encoding. </p>
<p>If anyone has any suggestions for my problem, do leave a comment.</p>
<div id="in_post_ad_bottom_1" style="clear:both;margin:0;padding:0;"><div class="brp-bp-234">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-4254382394977039";
/* brp-234x60-bp */
google_ad_slot = "7787511801";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div class="brp-bp-234">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-4254382394977039";
/* brp-234x60-BP-1 */
google_ad_slot = "9111022353";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.rajatpandit.com/2009/12/19/creating-utf-8-tables-in-symfony-1-4-doctrine-1-2/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

