2015年11月16日月曜日

ubuntu namazu euc ファイル名が文字化け

namazuをそのまま使うといろんな場所で文字化けを起こします。
namazuで取り扱う文字コードがEUCなことが問題のようです。
取り込んだ文字列を toeuc という関数で 文字コード変換していますが、
/usr/bin/mknmz は少し足りない&間違っています。

下記のあたりを突貫工事します(美しくないは知らない)。

470行あたり
unless ($uri) {
    my $lcfile = $cfile;
    codeconv::toeuc(\$lcfile);
    $uri = generate_uri($lcfile);  # Make a URI from a file name.
}
560行あたり
unless ($var::Opt{'noencodeuri'}) {
    for my $tmp ($file, $fragment) {
        next unless defined $tmp;
        # Escape unsafe characters (not strict)
        $tmp =~ s/\%/%25/g;  # Convert original '%' into '%25' v1.1.1.2
        $tmp =~ s/([^a-zA-Z0-9~\-\_\.\/\:\%])/
        sprintf("%%%02X",ord($1))/ge;
    }
 }else{
    for my $tmp ($file, $fragment) {
        next unless defined $tmp;
        codeconv::toeuc(\$tmp);
    }
}
620行あたり
unless (defined($fields->{'title'})) {
    my $lcfile = $cfile;
    codeconv::toeuc(\$lcfile);
    $fields->{'title'} = gfilter::filename_to_title($lcfile, $wsref);
}

0 件のコメント:

コメントを投稿