Little refacto for encoding.rb