auto detection of encoding