Fix encoding when reading strings