unidecoder gemを試していますが、いくつかの文字列に問題があります。
require 'unidecoder'
str = "\u00A3"
str.to_ascii
#:( C:/Ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder/data/x00.yml):2行目で引用符dスカラーを解析中に不明なエスケープ文字が見つかりました列3fromC:/Ruby193/lib/ruby/1.9.1/psych.rb:203:in
parse' from C:/Ruby193/lib/ruby/1.9.1/psych.rb:203:in
parse_stream'from C:/Ruby193/lib/ruby/1.9.1/psych.rb:151:inparse' from C:/Ruby193/lib/ruby/1.9.1/psych.rb:127:in
load' from C :/Ruby193/lib/ruby/1.9.1/psych.rb:297:inblock in load_file' from C:/Ruby193/lib/ruby/1.9.1/psych.rb:297:in
open'from C:/Ruby193/lib/ruby/1.9.1/psych.rb:297:inload_file' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:8:in
block in' from C:/Ruby193 /lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:78:in default'fromyield' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:78:in
C:/Ruby193/lib/ruby/gems/1.9.1/gems/unidecoder- 1.1.1 / lib / unidecoder.rb:78:indecode_char' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:39:in
block in decode'from C:/Ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:37:ingsub' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:37:in
'をC:/Ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:16:into_ascii' from (irb):21 from C:/Ruby193/bin/irb:12:in
' >>
さらに悪いことに、次のようにしてエラーをキャッチすることはできません。
foo = str.to_ascii rescue 'x'
ここで何が起こっているのか誰か知っていますか?