I'm trying to load a bunch of utf-8 encoded strings and dump them again with PyYaml. This is the code for loading/dumping:
lang_yml = yaml.load(codecs.open(lang + ".yml.old", "r", "utf-8"))
test_file_path = lang + '.yml'
stream = file(test_file_path, 'w')
yaml.dump(lang_yml, stream, default_flow_style=False, encoding=('utf-8'))
But a strings that start as "En arrière" ends up being saved as "En arri\xE8re". What am I doing wrong?