Improve reseting encoding to 8 bit to prevent from exception