Archive for the ‘MovableType’ Category

使用Windows Live Writer在MovableType发表文章出现乱码的解决办法

使用Windows Live Writer在MovableType 4.23 pro发表文章出现会出现乱码,

打开 lib/MT/Util.pm, 大约640行,把函数改下
sub remove_html {
    my($text) = @_;
    return ” if !defined $text;  # suppress warnings
    $text =~ s/(<\!\[CDATA\[(.*?)\]\]>)|(<[^>]+>)/
        defined $1 ? $1 : ”
        /geisx;
    $text =~ s/<(?!\!\[CDATA\[)/&lt;/gis;
    return $text;
}

改成 
sub remove_html {
    my($text) = @_;
    return $text if !defined $text;  # suppress warnings
    return $text if $text =~ m/^<\!\[CDATA\[/i;
    $text =~ s!<[^>]+>!!gs;
    $text =~ s!<!&lt;!gs;
    $text;
}

写博客真难受