<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="http://www.majordojo.com/projects/FeedManager/atom.xsl" type="text/xsl" media="screen"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html" />
  <link rel="self" type="application/atom+xml" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html" />
  <id>tag:www.thinkjam.org,2009:/zoptuno//2/tag:www.thinkjam.org,2004:/zoptuno//2.63-</id>
  <updated>2009-09-21T03:18:46Z</updated>
  <title>Comments for TrackBack乱码，没有安装Text::Iconv模块的解决办法</title>
  <subtitle>My think. My dream.</subtitle>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.31-zh-cn</generator>
  <entry>
    <id>tag:www.thinkjam.org,2004:/zoptuno//2.63</id>
    <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.thinkjam.org/loveblog/batom.cgi/weblog/blog_id=2/entry_id=63" title="TrackBack乱码，没有安装Text::Iconv模块的解决办法" />
    <published>2004-11-06T16:06:49Z</published>
    <updated>2008-11-07T16:34:15Z</updated>
    <title>TrackBack乱码，没有安装Text::Iconv模块的解决办法</title>
    <summary>近日一直被MT引用通告乱码所困扰，虽然Google到了Hedong的消除收到tr...</summary>
    <author>
      <name>平生一笑</name>
      <uri>http://www.thinkjam.org/zoptuno</uri>
    </author>
    
    <category term="MovableType" />
    
    <content type="html" xml:lang="en" xml:base="http://www.thinkjam.org/zoptuno/">
      <![CDATA[<p>近日一直被MT引用通告乱码所困扰，虽然<a href="http://www.google.com/" target="_blank">Google</a>到了<a href="http://hedong.3322.org/newblog/" target="_blank">Hedong</a>的<a href="http://hedong.3322.org/newblog/archives/000062.html" target="_blank">消除收到trackback的乱码</a>文章，还有<a href="http://www.douzi.org/weblog/" target="_blank">Windix</a>的<a href="http://www.douzi.org/weblog/archives/000064.html" target="_blank">Trackback乱码：我的解决方法</a>。但一由于我的空间上没有安装CGI的Text::Iconv模块，二<a href="http://www.douzi.org/weblog/" target="_blank">Windix</a>并没有提供自己写的编码转换Douconv库，我只能望洋兴叹。不过我用的空间是Linux主机，安装有iconv common包，可以使用iconv命令，因此尝试用Perl执行命令来解决转码问题，下面是具体的解决方法（当然，这里要感谢<a href="http://hedong.3322.org/newblog/" target="_blank">Hedong</a>前辈已有的方法，我是在其基础上稍加变化实现的）：</p>]]>
      <![CDATA[<p>在$MTHOME/lib/MT/App/Trackback.pm的ping函数中找到：</p>

<pre><code>my $ping = MT::TBPing-&gt;new;
$ping-&gt;blog_id($tb-&gt;blog_id);
$ping-&gt;tb_id($tb_id);
$ping-&gt;source_url($url);
$ping-&gt;ip($app-&gt;remote_ip || '');</code> </pre>

<p>在其前面加上：</p>

<pre><code>#################convert gb2312 into utf-8 if necessary#######
require LWP::UserAgent;
my $ua = LWP::UserAgent-&gt;new;
my $req = HTTP::Request-&gt;new(GET =&gt; $url);
my $res = $ua-&gt;request($req);
if ($res-&gt;is_success) {
     my $content=$res-&gt;content;
     if ($content =~ /text\/html.*charset=.*gb.*&gt;/gi ){
        $excerpt = `echo $excerpt | iconv -f GB2312 -t UTF-8`;
        $title = `echo $title | iconv -f GB2312 -t UTF-8`;
        $blog_name = `echo $blog_name | iconv -f GB2312 -t UTF-8`;
    }
}</code></pre>

<p>##############end convert gb2312 to utf8################## </p>

<p>完毕！</p>

<p>上述修改在MT 3.x版本上适用，依照Hedong所说，<font color="red">如果系统安装了mt-blacklist，则需要修改$MTHOME/extlib/jayallen/MTBlPing.pm，位置相同。</font></p>]]>
    </content>
  </entry>

  <entry>
    <id>tag:www.thinkjam.org,2004:/zoptuno//2.63-comment:613</id>
    <thr:in-reply-to ref="tag:www.thinkjam.org,2004:/zoptuno//2.63" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html"/>
    <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html#c613" />
    <title>Comment from ASDFASDF on 2004-12-16</title>
    <author>
        <name>ASDFASDF</name>
<!--         -->
    </author>
    <content type="html" xml:lang="en" xml:base="">
	<![CDATA[<p>許=B35C 功=A55C 蓋=BB5C</p>]]>
    </content>
    <published>2004-12-16T03:28:47Z</published>
    <updated>2004-12-16T03:28:47Z</updated>
  </entry>

  <entry>
    <id>tag:www.thinkjam.org,2004:/zoptuno//2.63-comment:614</id>
    <thr:in-reply-to ref="tag:www.thinkjam.org,2004:/zoptuno//2.63" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html"/>
    <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html#c614" />
    <title>Comment from jimpim on 2005-04-01</title>
    <author>
        <name>jimpim</name>
<!--        <uri>http://www.mornshine.net</uri> -->
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.mornshine.net">
	<![CDATA[<p>我的blog空间没有iconv组件，使用了一个类来解决问题。详见《不用iconv组件也能支持简繁体》http://www.mornshine.net/index.php?job=single&art=9</p>]]>
    </content>
    <published>2005-04-01T14:12:50Z</published>
    <updated>2005-04-01T14:12:50Z</updated>
  </entry>

  <entry>
    <id>tag:www.thinkjam.org,2004:/zoptuno//2.63-comment:615</id>
    <thr:in-reply-to ref="tag:www.thinkjam.org,2004:/zoptuno//2.63" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html"/>
    <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html#c615" />
    <title>Comment from 魂牵梦萦 on 2006-01-14</title>
    <author>
        <name>魂牵梦萦</name>
<!--        <uri>http://test</uri> -->
    </author>
    <content type="html" xml:lang="en" xml:base="http://test">
	<![CDATA[<p>test</p>]]>
    </content>
    <published>2006-01-14T06:49:26Z</published>
    <updated>2006-01-14T06:49:26Z</updated>
  </entry>

  <entry>
    <id>tag:www.thinkjam.org,2004:/zoptuno//2.63-comment:616</id>
    <thr:in-reply-to ref="tag:www.thinkjam.org,2004:/zoptuno//2.63" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html"/>
    <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html#c616" />
    <title>Comment from woj on 2006-02-27</title>
    <author>
        <name>woj</name>
<!--        <uri>http://www.supod.com</uri> -->
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.supod.com">
	<![CDATA[<p>谢谢您</p>]]>
    </content>
    <published>2006-02-27T06:01:33Z</published>
    <updated>2006-02-27T06:01:33Z</updated>
  </entry>

  <entry>
    <id>tag:www.thinkjam.org,2004:/zoptuno//2.63-comment:617</id>
    <thr:in-reply-to ref="tag:www.thinkjam.org,2004:/zoptuno//2.63" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html"/>
    <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html#c617" />
    <title>Comment from woj on 2006-02-27</title>
    <author>
        <name>woj</name>
<!--        <uri>http://supod.com</uri> -->
    </author>
    <content type="html" xml:lang="en" xml:base="http://supod.com">
	<![CDATA[<p>不错,正是我需要的：）<br />
                    速泡网</p>]]>
    </content>
    <published>2006-02-27T06:07:25Z</published>
    <updated>2006-02-27T06:07:25Z</updated>
  </entry>

  <entry>
    <id>tag:www.thinkjam.org,2004:/zoptuno//2.63-comment:618</id>
    <thr:in-reply-to ref="tag:www.thinkjam.org,2004:/zoptuno//2.63" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html"/>
    <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html#c618" />
    <title>Comment from amao on 2006-06-26</title>
    <author>
        <name>amao</name>
<!--        <uri>http://www.flyy.info</uri> -->
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.flyy.info">
	<![CDATA[<p>可以使用转换表的,sablog-x里面就有解决方法</p>]]>
    </content>
    <published>2006-06-26T00:30:22Z</published>
    <updated>2006-06-26T00:30:22Z</updated>
  </entry>

  <entry>
    <id>tag:www.thinkjam.org,2004:/zoptuno//2.63-comment:619</id>
    <thr:in-reply-to ref="tag:www.thinkjam.org,2004:/zoptuno//2.63" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html"/>
    <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html#c619" />
    <title>Comment from sangern on 2007-03-08</title>
    <author>
        <name>sangern</name>
<!--        <uri>http://www.kankanblog.com/</uri> -->
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.kankanblog.com/">
	<![CDATA[<p>但愿有用</p>]]>
    </content>
    <published>2007-03-08T06:59:03Z</published>
    <updated>2007-03-08T06:59:03Z</updated>
  </entry>

  <entry>
    <id>tag:www.thinkjam.org,2004:/zoptuno//2.63-comment:620</id>
    <thr:in-reply-to ref="tag:www.thinkjam.org,2004:/zoptuno//2.63" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html"/>
    <link rel="alternate" type="text/html" href="http://www.thinkjam.org/zoptuno/archives/2004/11/trackbackaeciee.html#c620" />
    <title>Comment from 平生一笑 on 2007-03-08</title>
    <author>
        <name>平生一笑</name>
<!--        <uri>http://www.thinkjam.org/zoptuno/</uri> -->
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.thinkjam.org/zoptuno/">
	<![CDATA[<p>这个好像很早了，现在记得有个插件可以实现自动解码的，不过非UTF-8的Blog好像也不多了</p>]]>
    </content>
    <published>2007-03-08T07:12:37Z</published>
    <updated>2007-03-08T07:12:37Z</updated>
  </entry>

</feed>
