implement encoding detection and some tests