<?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>花儿开了 &#187; mt</title>
	<atom:link href="http://blog.istef.info/tag/mt/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.istef.info</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 06 Jun 2010 05:52:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel='hub' href='http://blog.istef.info/?pushpress=hub'/>
		<item>
		<title>Movable Type 迁移乱码问题的解决</title>
		<link>http://blog.istef.info/2006/09/13/the-solution-of-mysql-character-problem-while-the-migration-of-movabletype/</link>
		<comments>http://blog.istef.info/2006/09/13/the-solution-of-mysql-character-problem-while-the-migration-of-movabletype/#comments</comments>
		<pubDate>Tue, 12 Sep 2006 16:12:28 +0000</pubDate>
		<dc:creator>iStef</dc:creator>
				<category><![CDATA[Experiences]]></category>
		<category><![CDATA[bluehost]]></category>
		<category><![CDATA[charset]]></category>
		<category><![CDATA[flypig]]></category>
		<category><![CDATA[mt]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.istef.info/2006/09/13/the-solution-of-mysql-character-problem-while-the-migration-of-movabletype/</guid>
		<description><![CDATA[飞猪这两天被博客搬家的事情搞得坐卧不安，他的博客平台为 Movable Type，新的虚拟主机选择的是 Bluehost 的虚拟主机，也因此碰到了一个很常见，很麻烦的问题——乱码。今天帮他解决了这个问题，丫很高兴，非让我写个“通俗易懂”的教程造福全人类，那我就写的尽量通俗一点好了。 适用条件：原来的数据库为 MySQL 3.X 或 4.0.X（比如飞猪原来用的玛雅网络），迁移到的数据库为 MySQL 4.1.X 及以上版本。 具体步骤： 在原来的主机（Mysql 3.x/4.0.x）上使用 phpMyAdmin 导出数据，导出时要注意先点击左侧被导出的数据库，然后点击右侧上方的 Export，选中所有的表，导出即可。 在新主机（MySQL 4.1.x or higher）上使用 phpMyAdmin 建立一个数据库（或者使用虚拟主机的面板建立也可以），然后在 phpMyAdmin 中打开这个数据库（左侧点击数据库名），点击右侧的 Operations，然后将下方的 Collection 更改为 utf8-general-ci。 点击 Import，将第一步导出的数据导入数据库。 找到 /lib/MT/ObjectDriver/DBI/mysql.pm，找到这样一段（修改位置在 99 行，MT 3.2），按照下面的提示修改： sub init { &#160;&#160; &#160;my $driver = shift; &#160;&#160; &#160;$driver-&#62;SUPER::init(@_); &#160;&#160; &#160;my $cfg = $driver-&#62;cfg; &#160;&#160; &#160;my [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flypig.org">飞猪</a>这两天被博客搬家的事情搞得<a href="http://www.flypig.org/001942.html">坐卧不安</a>，他的博客平台为 Movable Type，新的虚拟主机选择的是 <a href="http://www.bluehost.com">Bluehost</a> 的虚拟主机，也因此碰到了一个很常见，很麻烦的问题——乱码。今天帮他解决了这个问题，丫很高兴，非让我写个“通俗易懂”的教程造福全人类，那我就写的尽量通俗一点好了。</p>
<p>适用条件：原来的数据库为 MySQL 3.X 或 4.0.X（比如飞猪原来用的玛雅网络），迁移到的数据库为 MySQL 4.1.X 及以上版本。</p>
<p>具体步骤：
<ol>
<li>在原来的主机（Mysql 3.x/4.0.x）上使用 phpMyAdmin 导出数据，导出时要注意先点击左侧被导出的数据库，然后点击右侧上方的 Export，选中所有的表，导出即可。</li>
<li>在新主机（MySQL 4.1.x or higher）上使用 phpMyAdmin 建立一个数据库（或者使用虚拟主机的面板建立也可以），然后在 phpMyAdmin 中打开这个数据库（左侧点击数据库名），点击右侧的 Operations，然后将下方的 Collection 更改为 utf8-general-ci。</li>
<li>点击 Import，将第一步导出的数据导入数据库。</li>
<li>找到 <mt-dir>/lib/MT/ObjectDriver/DBI/mysql.pm，找到这样一段（修改位置在 99 行，MT 3.2），按照下面的提示修改：
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">sub init {</li>
<li>&nbsp;&nbsp; &nbsp;my $driver = shift;</li>
<li>&nbsp;&nbsp; &nbsp;$driver-&gt;SUPER::init(@_);</li>
<li>&nbsp;&nbsp; &nbsp;my $cfg = $driver-&gt;cfg;</li>
<li>&nbsp;&nbsp; &nbsp;my $dsn = 'dbi:mysql:database=' . $cfg-&gt;Database;</li>
<li>&nbsp;&nbsp; &nbsp;$dsn .= ';hostname=' . $cfg-&gt;DBHost if $cfg-&gt;DBHost;</li>
<li>&nbsp;&nbsp; &nbsp;$dsn .= ';mysql_socket=' . $cfg-&gt;DBSocket if $cfg-&gt;DBSocket;</li>
<li>&nbsp;&nbsp; &nbsp;$dsn .= ';port=' . $cfg-&gt;DBPort if $cfg-&gt;DBPort;</li>
<li>&nbsp;&nbsp; &nbsp;$driver-&gt;{dbh} = DBI-&gt;connect($dsn, $cfg-&gt;DBUser, $cfg-&gt;DBPassword,</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{ RaiseError =&gt; 0, PrintError =&gt; 0 })</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;or return $driver-&gt;error(MT-&gt;translate(&quot;Connection error: [_1]&quot;,</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $DBI::errstr));</li>
<li>&nbsp;&nbsp; &nbsp;$driver-&gt;{dbh}-&gt;do(&quot;SET NAMES 'utf8'&quot;); // 添加这一行</li>
<li>&nbsp;&nbsp; &nbsp;$driver;</li>
<li>}</li></ol></div>
</li>
</ol>
<p>好了，乱码问题应该没有了。Enjoy!</p>
<p>下面简单讲讲原理，不想看的略过就好了，呵呵<span id="more-520"></span></p>
<p>其实问题主要出在 MySQL 上。MySQL 自从 4.1 版开始，添加了字符集支持。MySQL 在存取数据的时候，会对字符集进行转换。而 MySQL 之前的版本没有这个特性，升级的时候，MySQL 4.1 会将他们统统认为 latin1-swedish-ci。而像 MT, WordPress 那样使用 UTF-8 编码存储的程序在这里就会出问题了。</p>
<p>解决这个问题，有个取巧的办法。因为 MySQL 3.X 因为没有这个特性，当我们导出 MySQL 数据表时并不包含字符集设置的信息。在导入 MySQL 4.1.x 之前，我们首先将数据库默认的字符集设定为 UTF-8，再导入，字符集就正确了。</p>
<p>修改 MT 那个文件，就是为了让 MT 能够按照正确的字符集来读写 MySQL。SET NAMES &#8216;UTF8&#8242; 这条命令就是将输入输出字符均设置为 UTF-8，由此便解决了乱码问题。</p>
<p>本文参考了<a href="http://www.kingda.org/archives/kingda/2006/04/mt32_1.html">这篇文章</a>，这篇文章的方法在两个 MySQL 4.1.x 数据库之间迁移时，并且可以使用 Shell 的情况下会非常好用。如果您属于这种情况，可以参考一下。</p>
<p>本文所讲述的方法在 <a href="http://www.flypig.org">Flypig 的博客</a>上验证通过。
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.istef.info%2F2006%2F09%2F13%2Fthe-solution-of-mysql-character-problem-while-the-migration-of-movabletype%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.istef.info%2F2006%2F09%2F13%2Fthe-solution-of-mysql-character-problem-while-the-migration-of-movabletype%2F&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.istef.info/2006/09/13/the-solution-of-mysql-character-problem-while-the-migration-of-movabletype/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>2005了，写一点吧</title>
		<link>http://blog.istef.info/2005/01/05/2005%e4%ba%86%ef%bc%8c%e5%86%99%e4%b8%80%e7%82%b9%e5%90%a7/</link>
		<comments>http://blog.istef.info/2005/01/05/2005%e4%ba%86%ef%bc%8c%e5%86%99%e4%b8%80%e7%82%b9%e5%90%a7/#comments</comments>
		<pubDate>Wed, 05 Jan 2005 15:12:05 +0000</pubDate>
		<dc:creator>iStef</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[mt]]></category>
		<category><![CDATA[newyear]]></category>

		<guid isPermaLink="false">http://blog.istef.info/2005/01/05/2005%e4%ba%86%ef%bc%8c%e5%86%99%e4%b8%80%e7%82%b9%e5%90%a7/</guid>
		<description><![CDATA[2005年也过了好几天了，一直没有更新Blog，一方面面临考试课业繁重，另一方面也是懒，打开电脑就知道享受。天天少看两个MV也就写了。 看来好多朋友的博客，或多或少都对自己的2004做了个总结。我的印象中，进来十几个岁月不过都是在忙忙碌碌和碌碌无为之中度过的，二○○四也不例外，就不要总结了（还是偷懒）。 进来一直再忙着NKBlog.org的建设，问题真是多多。看来建设一个网站容易，维护起来真是困难呀。现在关注nkblog的人越来越多了，今天还惊喜的发现建成不过几天的NKblog.org首页的PageRank竟然有3，真是不知道google这丫的是用的什么鬼算法。 眼看着假期也就到了，最近也不准备再频繁更新了。为了2005能有个崭新的开始，准备给Blog换换脸。具体怎么做还没相好，呵呵。 另外，对于NKBlog.org的所有用户，这里先说声Sorry了。最近时间实在是紧张，很难抽出大段的时间来写代码了，因此博客如果出现了什么问题，除非重大安全问题，一般暂时不会解决了。期待寒假吧，寒假要好好修理修理这个Movable Type~~~~]]></description>
			<content:encoded><![CDATA[<p>2005年也过了好几天了，一直没有更新Blog，一方面面临考试课业繁重，另一方面也是懒，打开电脑就知道享受。天天少看两个MV也就写了。<br />
看来好多朋友的博客，或多或少都对自己的2004做了个总结。我的印象中，进来十几个岁月不过都是在忙忙碌碌和碌碌无为之中度过的，二○○四也不例外，就不要总结了（还是偷懒）。<br />
进来一直再忙着<a href="nkblog.org" target="_blank">NKBlog.org</a>的建设，问题真是多多。看来建设一个网站容易，维护起来真是困难呀。现在关注nkblog的人越来越多了，今天还惊喜的发现建成不过几天的NKblog.org首页的PageRank竟然有3，真是不知道google这丫的是用的什么鬼算法。<br />
眼看着假期也就到了，最近也不准备再频繁更新了。为了2005能有个崭新的开始，准备给Blog换换脸。具体怎么做还没相好，呵呵。</p>
<p>另外，对于NKBlog.org的所有用户，这里先说声Sorry了。最近时间实在是紧张，很难抽出大段的时间来写代码了，因此博客如果出现了什么问题，除非重大安全问题，一般暂时不会解决了。期待寒假吧，寒假要好好修理修理这个Movable Type~~~~
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.istef.info%2F2005%2F01%2F05%2F2005%25e4%25ba%2586%25ef%25bc%258c%25e5%2586%2599%25e4%25b8%2580%25e7%2582%25b9%25e5%2590%25a7%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.istef.info%2F2005%2F01%2F05%2F2005%25e4%25ba%2586%25ef%25bc%258c%25e5%2586%2599%25e4%25b8%2580%25e7%2582%25b9%25e5%2590%25a7%2F&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.istef.info/2005/01/05/2005%e4%ba%86%ef%bc%8c%e5%86%99%e4%b8%80%e7%82%b9%e5%90%a7/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>对垃圾say NO !</title>
		<link>http://blog.istef.info/2004/10/04/%e5%af%b9%e5%9e%83%e5%9c%besay-no/</link>
		<comments>http://blog.istef.info/2004/10/04/%e5%af%b9%e5%9e%83%e5%9c%besay-no/#comments</comments>
		<pubDate>Mon, 04 Oct 2004 13:11:53 +0000</pubDate>
		<dc:creator>iStef</dc:creator>
				<category><![CDATA[this site]]></category>
		<category><![CDATA[blacklist]]></category>
		<category><![CDATA[mt]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://blog.istef.info/2004/10/04/%e5%af%b9%e5%9e%83%e5%9c%besay-no/</guid>
		<description><![CDATA[昨日在Thunder站长的大力支持下，本人为nkblog的Movable Type系统武装上了反垃圾留言插件 MT-BlackList。与其说是为民造福不如说是先为己造福，因为本人的博客是南开站上遭受垃圾留言骚扰最严重的博客，共有XXX条。人的忍耐是有限的，在看到本人一篇含有高频关键字文章有50条垃圾留言后，哼哼……“我不要再忍了！！” 安装没什么困难，现在已经在他的保护之下了，今天只受到一个垃圾留言。不每天少了XX条，嘿嘿！看来还是比较有效的。]]></description>
			<content:encoded><![CDATA[<p align="center"><img alt="mt-bl.jpg" src="http://blog.istef.info/wp-content/uploads/mt-bl.jpg" width="490" height="240" border="0" /></p>
<p>
昨日在Thunder站长的大力支持下，本人为nkblog的Movable Type系统武装上了反垃圾留言插件 MT-BlackList。与其说是为民造福不如说是先为己造福，因为本人的博客是南开站上遭受垃圾留言骚扰最严重的博客，共有XXX条。人的忍耐是有限的，在看到本人一篇含有高频关键字文章有50条垃圾留言后，哼哼……“我不要再忍了！！”
</p>
<p>
安装没什么困难，现在已经在他的保护之下了，今天只受到一个垃圾留言。不每天少了XX条，嘿嘿！看来还是比较有效的。
</p>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.istef.info%2F2004%2F10%2F04%2F%25e5%25af%25b9%25e5%259e%2583%25e5%259c%25besay-no%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.istef.info%2F2004%2F10%2F04%2F%25e5%25af%25b9%25e5%259e%2583%25e5%259c%25besay-no%2F&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.istef.info/2004/10/04/%e5%af%b9%e5%9e%83%e5%9c%besay-no/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Database Caching 1/14 queries in 0.008 seconds using memcached
Object Caching 558/586 objects using memcached

Served from: blog.istef.info @ 2012-02-13 05:14:37 -->
