use 'each_char.to_a' to replace 'chars' for better backward compatibility. Also 'jcode' is necessary for Ruby 1.8.5 to use 'each_char' method according to https://www.ruby-forum.com/topic/157574