Other refactor for encoding.rb