fix to check for an encoding