minorly refactor Encoding Detector