<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: MySQL encoding</title>
	<atom:link href="http://fschiettecatte.wordpress.com/2007/05/18/mysql-encoding/feed/" rel="self" type="application/rss+xml" />
	<link>http://fschiettecatte.wordpress.com/2007/05/18/mysql-encoding/</link>
	<description>Thoughts from the edge of the 'net</description>
	<pubDate>Fri, 16 May 2008 20:51:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
		<item>
		<title>By: François Schiettecatte</title>
		<link>http://fschiettecatte.wordpress.com/2007/05/18/mysql-encoding/#comment-2212</link>
		<dc:creator>François Schiettecatte</dc:creator>
		<pubDate>Tue, 28 Aug 2007 11:42:57 +0000</pubDate>
		<guid isPermaLink="false">http://fschiettecatte.wordpress.com/2007/05/18/mysql-encoding/#comment-2212</guid>
		<description>Joseph

Thanks, that would be my understanding too, but the documentation is silent on the issue. I would assume that they have done the "right thing" though.</description>
		<content:encoded><![CDATA[<p>Joseph</p>
<p>Thanks, that would be my understanding too, but the documentation is silent on the issue. I would assume that they have done the &#8220;right thing&#8221; though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph Riesen</title>
		<link>http://fschiettecatte.wordpress.com/2007/05/18/mysql-encoding/#comment-2207</link>
		<dc:creator>Joseph Riesen</dc:creator>
		<pubDate>Tue, 28 Aug 2007 08:29:46 +0000</pubDate>
		<guid isPermaLink="false">http://fschiettecatte.wordpress.com/2007/05/18/mysql-encoding/#comment-2207</guid>
		<description>Thanks for the information!  I was looking for these assorted options (to force a development server to talk UTF-8) and found your page here.

FYI, read about the space requirements for UTF-8 at:
http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html

Specifically, it states:
"Tip: To save space with UTF-8, use VARCHAR instead of CHAR. Otherwise, MySQL must reserve three bytes for each character in a CHAR CHARACTER SET utf8 column because that is the maximum possible length. For example, MySQL must reserve 30 bytes for a CHAR(10) CHARACTER SET utf8 column."

In other words, you _are_ correct in stating that a CHAR(20) in UTF-8 will require 60 bytes, but a VARCHAR will continue to reserve only the number of bytes necessary to hold the string.  In other words, a VARCHAR(20) _could_ use up to 60 bytes of storage, but any lower-ASCII characters will still only take up one byte.

Or at least, so I understand it.  YMMV.  =)</description>
		<content:encoded><![CDATA[<p>Thanks for the information!  I was looking for these assorted options (to force a development server to talk UTF-8) and found your page here.</p>
<p>FYI, read about the space requirements for UTF-8 at:<br />
<a href="http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html</a></p>
<p>Specifically, it states:<br />
&#8220;Tip: To save space with UTF-8, use VARCHAR instead of CHAR. Otherwise, MySQL must reserve three bytes for each character in a CHAR CHARACTER SET utf8 column because that is the maximum possible length. For example, MySQL must reserve 30 bytes for a CHAR(10) CHARACTER SET utf8 column.&#8221;</p>
<p>In other words, you _are_ correct in stating that a CHAR(20) in UTF-8 will require 60 bytes, but a VARCHAR will continue to reserve only the number of bytes necessary to hold the string.  In other words, a VARCHAR(20) _could_ use up to 60 bytes of storage, but any lower-ASCII characters will still only take up one byte.</p>
<p>Or at least, so I understand it.  YMMV.  =)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: noel</title>
		<link>http://fschiettecatte.wordpress.com/2007/05/18/mysql-encoding/#comment-863</link>
		<dc:creator>noel</dc:creator>
		<pubDate>Sun, 03 Jun 2007 06:31:52 +0000</pubDate>
		<guid isPermaLink="false">http://fschiettecatte.wordpress.com/2007/05/18/mysql-encoding/#comment-863</guid>
		<description>aww man I was dealing with this very issue last year and ran across the same article.  One thing I read though was it's better to avoid char in UTF and just make everything varchar because varchar won't use more bytes than neccessary on standard ascii/latin chars.  Of course you lose the performance boost of setting all fields to char but the only place I ever saw anyone do that was at that one rss search engine company...

Here's the article I read:
http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html

It includes a few handy extras too like:

httpd.conf:
AddCharset UTF-8 .utf8
AddDefaultCharset UTF-8

php.ini
default_charset = "utf-8"

my.cnf
character-set-server=utf8
default-collation=utf8_unicode_ci

Also if you don't want everything connecting to the mysqld to get set to utf8, you can fire off a query immediately after connecting: "SET NAMES utf8" . 

This is good if you have some legacy crap you can't/won't/don't want to change.</description>
		<content:encoded><![CDATA[<p>aww man I was dealing with this very issue last year and ran across the same article.  One thing I read though was it&#8217;s better to avoid char in UTF and just make everything varchar because varchar won&#8217;t use more bytes than neccessary on standard ascii/latin chars.  Of course you lose the performance boost of setting all fields to char but the only place I ever saw anyone do that was at that one rss search engine company&#8230;</p>
<p>Here&#8217;s the article I read:<br />
<a href="http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html" rel="nofollow">http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html</a></p>
<p>It includes a few handy extras too like:</p>
<p>httpd.conf:<br />
AddCharset UTF-8 .utf8<br />
AddDefaultCharset UTF-8</p>
<p>php.ini<br />
default_charset = &#8220;utf-8&#8243;</p>
<p>my.cnf<br />
character-set-server=utf8<br />
default-collation=utf8_unicode_ci</p>
<p>Also if you don&#8217;t want everything connecting to the mysqld to get set to utf8, you can fire off a query immediately after connecting: &#8220;SET NAMES utf8&#8243; . </p>
<p>This is good if you have some legacy crap you can&#8217;t/won&#8217;t/don&#8217;t want to change.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
