Changed the encoding conditional to use r:(read) for when an incoding is passed