ruby - Problems catching unidecoder exceptions -


i'm trying out unidecoder gem , it's giving me problems strings:

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): found unknown escape character while parsing quote d scalar @ line 2 column 3 c:/ruby193/lib/ruby/1.9.1/psych.rb:203:in parse' c:/ruby193/lib/ruby/1.9.1/psych.rb:203:inparse_stream' c:/ruby193/lib/ruby/1.9.1/psych.rb:151:in parse' c:/ruby193/lib/ruby/1.9.1/psych.rb:127:inload' c:/ruby193/lib/ruby/1.9.1/psych.rb:297:in block in load_file' c:/ruby193/lib/ruby/1.9.1/psych.rb:297:inopen' c:/ruby193/lib/ruby/1.9.1/psych.rb:297:in load_file' c:/ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:8:in block in ' c:/ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:78:in yield' c:/ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:78:in default' c:/ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:78:in decode_char' c:/ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:39:in block in decode' c:/ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:37:in gsub' c:/ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:37:in decode' c:/ruby193/lib/ruby/gems/1.9.1/gems/unidecoder-1.1.1/lib/unidecoder.rb:16:in to_ascii' (irb):21 c:/ruby193/bin/irb:12:in'>>

what's worse, can't catch error doing:

foo = str.to_ascii rescue 'x' 

does know what's happening here?

rescue clause no parameter list, parameter defaults standarderror; looks unidecoder raises kinda other exception, stacktrace seems incomplete (it should show exception type.)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -