<?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: Converting mySQL latin1 to utf8</title>
	<atom:link href="http://www.saiweb.co.uk/mysql/converting-mysql-latin1-to-utf8/feed" rel="self" type="application/rss+xml" />
	<link>http://www.saiweb.co.uk/mysql/converting-mysql-latin1-to-utf8</link>
	<description>Ramblings of a Sys admin</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:55:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Simon</title>
		<link>http://www.saiweb.co.uk/mysql/converting-mysql-latin1-to-utf8/comment-page-1#comment-67236</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Wed, 12 Oct 2011 22:05:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=696#comment-67236</guid>
		<description>Here&#039;s a script to fix broken double encoded mysqldumps -- 
https://gist.github.com/1282752</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a script to fix broken double encoded mysqldumps &#8212;<br />
<a href="https://gist.github.com/1282752" rel="nofollow">https://gist.github.com/1282752</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://www.saiweb.co.uk/mysql/converting-mysql-latin1-to-utf8/comment-page-1#comment-67235</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Wed, 12 Oct 2011 22:04:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=696#comment-67235</guid>
		<description>Here&#039;s a little script that might help you, doubledecode.py -- https://gist.github.com/1282752</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a little script that might help you, doubledecode.py &#8212; <a href="https://gist.github.com/1282752" rel="nofollow">https://gist.github.com/1282752</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dvb</title>
		<link>http://www.saiweb.co.uk/mysql/converting-mysql-latin1-to-utf8/comment-page-1#comment-42279</link>
		<dc:creator>dvb</dc:creator>
		<pubDate>Thu, 12 May 2011 02:01:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=696#comment-42279</guid>
		<description>You can use &#039;--hex-blob&#039; to keep binary data intact.
I&#039;ve just used that to convert an old mybb forum.

Here is a quote:
  --hex-blob
Dump binary columns using hexadecimal notation (for example, &#039;abc&#039; becomes 0x616263). The affected data types are BINARY, VARBINARY, the BLOB types, and BIT.

( http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_hex-blob )

BTW,
Here are some improvements:
-----

curdate=`date +%Y-%m-%d`

mysqldump -u user -pXXXXX -h myhost.com --hex-blob --set-charset --default-character-set=latin1  databasename &gt; &quot;$curdate&quot;.latin1.sql

sed -i -e &quot;1 iSET NAMES utf8;&quot; -e &#039;s/^\([)] ENGINE=MyISAM \(AUTO_INCREMENT=[0-9]\+ \)\?DEFAULT CHARSET=\)latin1;$/\1utf8;/; s#^\(/\*![0-9]\+ SET NAMES \)latin1 \*/;$#\1utf8 \*/;#&#039;  &quot;$curdate&quot;.latin1.sql

iconv -f latin1 -t utf8 &quot;$curdate&quot;.latin1.sql &gt; &quot;$curdate&quot;.utf8.sql

rm &quot;$curdate&quot;.latin1.sql



mysql -u user -pXXXXX -h myhost.com databasename &lt; &quot;$curdate&quot;.utf8.sql

-----
Of course you should change the user, password, host and database names for your own.
$curdate just hold the current date in the format YYYY-MM-DD, and used for filenames, you could give it any value.
I&#039;m using just one sed, so it should be faster for large files.
The sed instructions are much more accurate and should never conflict with the data.</description>
		<content:encoded><![CDATA[<p>You can use &#8216;&#8211;hex-blob&#8217; to keep binary data intact.<br />
I&#8217;ve just used that to convert an old mybb forum.</p>
<p>Here is a quote:<br />
  &#8211;hex-blob<br />
Dump binary columns using hexadecimal notation (for example, &#8216;abc&#8217; becomes 0&#215;616263). The affected data types are BINARY, VARBINARY, the BLOB types, and BIT.</p>
<p>( <a href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_hex-blob" rel="nofollow">http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_hex-blob</a> )</p>
<p>BTW,<br />
Here are some improvements:<br />
&#8212;&#8211;</p>
<p>curdate=`date +%Y-%m-%d`</p>
<p>mysqldump -u user -pXXXXX -h myhost.com &#8211;hex-blob &#8211;set-charset &#8211;default-character-set=latin1  databasename &gt; &#8220;$curdate&#8221;.latin1.sql</p>
<p>sed -i -e &#8220;1 iSET NAMES utf8;&#8221; -e &#8216;s/^\([)] ENGINE=MyISAM \(AUTO_INCREMENT=[0-9]\+ \)\?DEFAULT CHARSET=\)latin1;$/\1utf8;/; s#^\(/\*![0-9]\+ SET NAMES \)latin1 \*/;$#\1utf8 \*/;#&#8217;  &#8220;$curdate&#8221;.latin1.sql</p>
<p>iconv -f latin1 -t utf8 &#8220;$curdate&#8221;.latin1.sql &gt; &#8220;$curdate&#8221;.utf8.sql</p>
<p>rm &#8220;$curdate&#8221;.latin1.sql</p>
<p>mysql -u user -pXXXXX -h myhost.com databasename &lt; &quot;$curdate&quot;.utf8.sql</p>
<p>&#8212;&#8211;<br />
Of course you should change the user, password, host and database names for your own.<br />
$curdate just hold the current date in the format YYYY-MM-DD, and used for filenames, you could give it any value.<br />
I&#039;m using just one sed, so it should be faster for large files.<br />
The sed instructions are much more accurate and should never conflict with the data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Buzz</title>
		<link>http://www.saiweb.co.uk/mysql/converting-mysql-latin1-to-utf8/comment-page-1#comment-15443</link>
		<dc:creator>Buzz</dc:creator>
		<pubDate>Wed, 06 Jan 2010 10:06:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=696#comment-15443</guid>
		<description>Hi Aboad,

In that case I would only run this conversion tool on the non binary data, as far as I am aware there is no encoding for the BLOB data type, running this conversion tool may incorrectly try to convert the data.</description>
		<content:encoded><![CDATA[<p>Hi Aboad,</p>
<p>In that case I would only run this conversion tool on the non binary data, as far as I am aware there is no encoding for the BLOB data type, running this conversion tool may incorrectly try to convert the data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aboad</title>
		<link>http://www.saiweb.co.uk/mysql/converting-mysql-latin1-to-utf8/comment-page-1#comment-14913</link>
		<dc:creator>aboad</dc:creator>
		<pubDate>Sun, 27 Dec 2009 08:14:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=696#comment-14913</guid>
		<description>Thank You , but what if the database has ( binary table ) like image and files ?</description>
		<content:encoded><![CDATA[<p>Thank You , but what if the database has ( binary table ) like image and files ?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 1/12 queries in 0.088 seconds using apc
Object Caching 436/444 objects using apc
Content Delivery Network via Rackspace Cloud Files: cdn.saiweb.co.uk

Served from: www.saiweb.co.uk @ 2012-02-08 21:01:13 -->
