>>49 俺ができるのはここまでだ.
本当は機種依存文字だけどうにかしたかったが,
重くなるしまともに動作するものが書けなかった.
require 'kconv'
droid = Android.new
in_path = droid.getIntent()['result']['extras']['%in_path']
out_path = droid.getIntent()['result']['extras']['%out_path']
in_buffer = File.open(in_path, 'r') { |f| f.read }
out_buffer = ''
begin
out_buffer = in_buffer.kconv(Kconv::UTF8, Kconv::EUC)
rescue
in_buffer.each_line do |line|
begin
out_buffer << line.kconv(Kconv::UTF8, Kconv::EUC)
rescue
line.gsub!(/[^\s!-~]/, '?')
out_buffer << line.kconv(Kconv::UTF8, Kconv::EUC)
end
end
end
File.open(out_path, 'w') { |f| f.write out_buffer }