From: GOTO Kentaro Date: 2002-09-27T11:59:47+09:00 Subject: Re: 'kakasi': different style for hiragana and katakana? At Fri, 27 Sep 2002 08:18:10 +0900, Rudolf Polzer wrote: > In my kakasi-renamer I want to change filenames to Roumaji as follows: > > hiragana > KATAKANA > Kanji As far as I know, kakasi doesn't have such function. > How to do that? I'm thinking of running kakasi multiple times, perhaps: > > Katakana->ASCII > upcase > Everything else->ASCII > > But this would also upcase existing ASCII characters in the file name. You can use gsub. require "kakasi" def eucjp_katakana_to_upcase(str) katakana_from = "\xa5\xa1" # small a katakana_end = "\xa5\xf6" # small ke katakana = /[#{katakana_from}-#{katakana_end}]+/em # em for euc&multiline str.gsub(katakana){Kakasi::kakasi("-ka -Ka", $&).upcase} end if __FILE__ == $0 puts eucjp_katakana_to_upcase(ARGF.read) end > Currently I have > > if Kconv::guess (name) != Kconv::UNKNOWN > euc = Kconv::toeuc (name) Kconv::guess and Kconv::toeuc uses different algorithms to determine encoding and "if Kconv::guess (name) != Kconv::UNKNOWN" may not work. -- Gotoken