From: Hammed Malik Date: 2006-09-28T06:42:04+09:00 Subject: Strange error in jcode.rb when converting range to array In my rails app I've line with the following code: ("a".."z").to_a Simple enough and it's been working for a while. Last night this line started throwing the following error: undefined method `[]' for nil:NilClass /usr/local/lib/ruby/1.8/jcode.rb:83:in `succ!' /usr/local/lib/ruby/1.8/jcode.rb:94 I looked up jcode.rb and the comments for this file say that it's "# jcode.rb - ruby code to handle japanese (EUC/SJIS) string" This is the part of jcode.rb that throws the error (line 83) 78 def succ! 79 reg = end_regexp 80 if self =~ reg 81 succ_table = SUCC[$KCODE[0,1].downcase] 83 begin 84 self[-1] += succ_table[self[-1]] 85 self[-2] += 1 if self[-1] == 0 86 end while self !~ reg 87 self 88 else 89 original_succ! 90 end 91 end Debugging is difficult because if I restart the app, the problem goes away..for a while. Has anyone else encountered this error before? It's obviously being caused by something I've added to my app recently. I just can't figure out what. ruby -v ruby 1.8.4 (2005-12-24) [i686-darwin8.5.2] Thanks Hammed