diff --git a/trunk/ripnews/encode/yenc.rb b/trunk/ripnews/encode/yenc.rb index aba693c..e7c9091 100644 --- a/trunk/ripnews/encode/yenc.rb +++ b/trunk/ripnews/encode/yenc.rb @@ -1,4 +1,4 @@ -# $Dwarf: yenc.rb,v 1.11 2004/10/18 08:13:47 ward Exp $ +# $Dwarf: yenc.rb,v 1.12 2004/10/18 18:35:39 ward Exp $ # $Source$ # @@ -27,9 +27,11 @@ class << self Debuglevel = 0 def ydecode(data, outfile=nil) - @ymap = {} - (-106..255).each do |b| - @ymap[b]=((b-42)%256) + unless @ymap + @ymap = {} + (-106..255).each do |b| + @ymap[b]=((b-42)%256) + end end case data.class.to_s @@ -62,7 +64,12 @@ def _ydecode_line(line) line[i] -= 64 end end - ostr << @ymap[line[i]] + begin + ostr << @ymap[line[i].to_i] + rescue TypeError + puts "this should not happen!!!" + puts "line[i] contents: '#{line[i]}'\n" + end i += 1 end return ostr