simplified the handling of encodings