読者です 読者をやめる 読者になる 読者になる

みかか変換(古いの)

昔の遺産を utf8 な環境で生かしてみる.

$ decodemikaka.pl hogehoge | nkf --utf8

nkf にリダイレクトしておけば,おkかな?

#!/usr/bin/perl
# -*- coding: euc-jp-unix -*-
use encoding "euc-jp";
use open IN  => ":utf8";
use open OUT => ":utf8";

my %table = (
"ぬ" => "1", # 
"ふ" => "2", # 
"あ" => "3", # 
"う" => "4", # 
"え" => "5", # 
"お" => "6", # 
"や" => "7", # 
"ゆ" => "8", # 
"よ" => "9", # 
"わ" => "0", # 
"ほ" => "-", # 
#"へ" => "^", # 
#▲ー\▲バックスラッシュと ¥記号 の関係から "ー" と "ろ" は重複する
"た" => "q", # 
"て" => "w", # 
"い" => "e", # 
"す" => "r", # 
"か" => "t", # 
"ん" => "y", # 
"な" => "u", # 
"に" => "i", # 
"ら" => "o", # 
"せ" => "p", # 
#"゛" => "@", # 
#"゜" => "[", # 
"ち" => "a", # 
"と" => "s", # 
"し" => "d", # 
"は" => "f", # 
"き" => "g", # 
"く" => "h", # 
"ま" => "j", # 
"の" => "k", # 
"り" => "l", # 
#"れ" => ";", # 
#"け" => ":", # 
#"む" => "]", # 
"つ" => "z", # 
"さ" => "x", # 
"そ" => "c", # 
"ひ" => "v", # 
"こ" => "b", # 
"み" => "n", # 
"も" => "m", # 
#"ね" => ",", # 
#"る" => ".", # 
#"め" => "/", # 
#"ろ" => "\", # 
    );

while (<>) {
    s/([あ-ん])/exists $table{$1} ? $table{$1} : $1/geo;
    print;
}

### end of file