<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Fixing column encoding mess in MySQL</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 07 Nov 2009 18:35:44 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: codeAPE &#187; Blog Archive &#187; Fixing UTF8 data that was inserted using the latin1 encoding</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-445092</link>
		<dc:creator>codeAPE &#187; Blog Archive &#187; Fixing UTF8 data that was inserted using the latin1 encoding</dc:creator>
		<pubDate>Wed, 14 Jan 2009 03:49:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-445092</guid>
		<description>[...] http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/   Posted in Computers &#124; [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/" rel="nofollow">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/</a>   Posted in Computers | [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brigada</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-363317</link>
		<dc:creator>brigada</dc:creator>
		<pubDate>Sun, 19 Oct 2008 21:20:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-363317</guid>
		<description>phpmyadmin makes this very easy to change - Open your database in phpmyadmin, select a table on the left, select the field(s) you need to change, click the With All: CHANGE button and change the collation. Depending on your amount of tables (i had 40) this takes about 10 min. max, and its error-free.

You can test it out on any old database you have if you wish before doing it &#039;&#039;live&#039;&#039; :)</description>
		<content:encoded><![CDATA[<p>phpmyadmin makes this very easy to change &#8211; Open your database in phpmyadmin, select a table on the left, select the field(s) you need to change, click the With All: CHANGE button and change the collation. Depending on your amount of tables (i had 40) this takes about 10 min. max, and its error-free.</p>
<p>You can test it out on any old database you have if you wish before doing it &#8221;live&#8221; <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tamcy</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-351091</link>
		<dc:creator>tamcy</dc:creator>
		<pubDate>Tue, 02 Sep 2008 06:43:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-351091</guid>
		<description>Sorry - answer to myself, but just realized the way to fix it and would like to share with the others.

As I said, the column expects utf8 data, and the data is correct when &quot;set names latin1&quot; is issued. 
This means I can get the correct (utf8) data when MySQL performs a &quot;utf8 -&gt; latin1&quot; conversion.
In order to fix the encoding I need to treat this &quot;latin1&quot; data as binary, then convert it to utf8.
And so here is the statement I need:

UPDATE table SET col = convert(CONVERT(CONVERT(col USING latin1) USING binary) using utf8);</description>
		<content:encoded><![CDATA[<p>Sorry &#8211; answer to myself, but just realized the way to fix it and would like to share with the others.</p>
<p>As I said, the column expects utf8 data, and the data is correct when &#8220;set names latin1&#8243; is issued.<br />
This means I can get the correct (utf8) data when MySQL performs a &#8220;utf8 -&gt; latin1&#8243; conversion.<br />
In order to fix the encoding I need to treat this &#8220;latin1&#8243; data as binary, then convert it to utf8.<br />
And so here is the statement I need:</p>
<p>UPDATE table SET col = convert(CONVERT(CONVERT(col USING latin1) USING binary) using utf8);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tamcy</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-351087</link>
		<dc:creator>tamcy</dc:creator>
		<pubDate>Tue, 02 Sep 2008 06:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-351087</guid>
		<description>Perhaps a more complicated issue:

The table is created with charset utf8 - correct.
A data is exported with charset utf8 - also correct.
But thing goes wrong when trying to import the data into mysql with &quot;\.&quot; syntax. The user forgot to run &quot;SET NAMES utf8&quot;, and MySQL sees all data as latin1.

Now, the script can use &quot;set names latin1&quot; to get back utf8 data.
However, &quot;CONVERT(CONVERT(offending_col USING binary) USING utf8)&quot; doesn&#039;t work - the same wrong garbage character is shown.</description>
		<content:encoded><![CDATA[<p>Perhaps a more complicated issue:</p>
<p>The table is created with charset utf8 &#8211; correct.<br />
A data is exported with charset utf8 &#8211; also correct.<br />
But thing goes wrong when trying to import the data into mysql with &#8220;\.&#8221; syntax. The user forgot to run &#8220;SET NAMES utf8&#8243;, and MySQL sees all data as latin1.</p>
<p>Now, the script can use &#8220;set names latin1&#8243; to get back utf8 data.<br />
However, &#8220;CONVERT(CONVERT(offending_col USING binary) USING utf8)&#8221; doesn&#8217;t work &#8211; the same wrong garbage character is shown.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andreea</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-348359</link>
		<dc:creator>andreea</dc:creator>
		<pubDate>Sun, 24 Aug 2008 13:16:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-348359</guid>
		<description>salut</description>
		<content:encoded><![CDATA[<p>salut</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shodan</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-326467</link>
		<dc:creator>shodan</dc:creator>
		<pubDate>Fri, 11 Jul 2008 13:08:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-326467</guid>
		<description>Jeroen,

this means that the data you&#039;re marking as UTF-8 is *not* really in UTF-8 encoding, and then UTF-8 decoder chokes.

Eg. if the binary data is actually is in Latin-1 encoding but you&#039;re tricking MySQL to think it&#039;s in UTF-8, the decoder will choke at the very first non-ASCII7 symbol.</description>
		<content:encoded><![CDATA[<p>Jeroen,</p>
<p>this means that the data you&#8217;re marking as UTF-8 is *not* really in UTF-8 encoding, and then UTF-8 decoder chokes.</p>
<p>Eg. if the binary data is actually is in Latin-1 encoding but you&#8217;re tricking MySQL to think it&#8217;s in UTF-8, the decoder will choke at the very first non-ASCII7 symbol.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen Sen</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-326426</link>
		<dc:creator>Jeroen Sen</dc:creator>
		<pubDate>Fri, 11 Jul 2008 12:14:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-326426</guid>
		<description>I&#039;ve used your conversion a bit for converting a database characterset latin_1 to an utf_8 characterset. (Just like SCC above.) But I have a problem with some special characters like &#039;ë&#039; and &#039;ä&#039; for example. When these characters are converted to their binary counterpart they are present in the database. But when I convert the database into utf_8 all contents of the fields containing these symbols are droppen starting form the symbol. Does anyone have a suggestion?

Thnx in advance!</description>
		<content:encoded><![CDATA[<p>I&#8217;ve used your conversion a bit for converting a database characterset latin_1 to an utf_8 characterset. (Just like SCC above.) But I have a problem with some special characters like &#8216;ë&#8217; and &#8216;ä&#8217; for example. When these characters are converted to their binary counterpart they are present in the database. But when I convert the database into utf_8 all contents of the fields containing these symbols are droppen starting form the symbol. Does anyone have a suggestion?</p>
<p>Thnx in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jerk</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-245636</link>
		<dc:creator>Jerk</dc:creator>
		<pubDate>Sat, 23 Feb 2008 16:53:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-245636</guid>
		<description>@Sven Neuhaus: That worked perfectly for Latin1 encoded chars in a UTF8 col. THANX!. That saved our lives.</description>
		<content:encoded><![CDATA[<p>@Sven Neuhaus: That worked perfectly for Latin1 encoded chars in a UTF8 col. THANX!. That saved our lives.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SCC</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-242423</link>
		<dc:creator>SCC</dc:creator>
		<pubDate>Thu, 14 Feb 2008 06:17:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-242423</guid>
		<description>I wish there was a way to change an entire table at once instead of going column by column.  I need to convert from latin1_swedish_ci to UTF8 for dozens of columns.</description>
		<content:encoded><![CDATA[<p>I wish there was a way to change an entire table at once instead of going column by column.  I need to convert from latin1_swedish_ci to UTF8 for dozens of columns.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shodan</title>
		<link>http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/comment-page-1/#comment-236594</link>
		<dc:creator>shodan</dc:creator>
		<pubDate>Fri, 01 Feb 2008 00:03:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/#comment-236594</guid>
		<description>Mohnkhan,
English is encoded exactly the same in both Latin-1 and UTF-8 so I&#039;d simply go with everything in UTF-8 for unification.</description>
		<content:encoded><![CDATA[<p>Mohnkhan,<br />
English is encoded exactly the same in both Latin-1 and UTF-8 so I&#8217;d simply go with everything in UTF-8 for unification.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
