Fixed a typo with encoding parsing

Seems like a typo with encoding parsing. 

Maybe required to merge into 1.5 stable as well?