Merging charset code with butils