おなかいっぱい

移転先

moblog mail gatewayを使って文字化けをした場合の対策。
文字コードが、EUCになっているブログ用です。

いろいろためしましたが、結局。
lib/MT/XMLRPCServer.pmの
45行目
use strict;
という行の前に
use Jcode;
という行を追加。

125行目(newPostのタブ)以降を書き換え
unless ($HAVE_XML_PARSER) {
for my $f (qw( title description mt_text_more
mt_excerpt mt_keywords )) {
next unless defined $item->{$f};
$item->{$f} = decode_html($item->{$f});
$item->{$f} =‾ s!'!'!g;
}
}
my $mt = MT::XMLRPCServer::Util::mt_new(); ## Will die if MT->new fails.
  ↓
unless ($HAVE_XML_PARSER) {
for my $f (qw( title description mt_text_more
mt_excerpt mt_keywords )) {
next unless defined $item->{$f};
$item->{$f} = decode_html($item->{$f});
$item->{$f} =‾ s!'!'!g;
}
}

for my $f (qw( title description mt_text_more mt_excerpt mt_keywords )) {
next unless defined $item->{$f};
$item->{$f} = Jcode->new($item->{$f},"utf8")->euc;
}

my $mt = MT::XMLRPCServer::Util::mt_new(); ## Will die if MT->new fails.

しかし、moblog mail gatewayにとりあえず対応するパッチなので、
いずれ、トラブルがでるはず(笑)

参考にしたサイト
http://rebecca.ac/milano/mt/archives/000318.html(本格的にパッチを当てる場合。)
http://uva.jp/dh/mt/archives/000639.html#000639(eucのパッチがMT2.61向けになっている。)

blog | Posted by simon_mobile at August 20, 2004 2:39 | Comments (5) | TrackBack (0)