split old and new implementation of Encoding Detector