Ticket #59 (closed defect: worksforme)
Load yaml data as utf-8 strings into a dictionary
|Reported by:||dukebody@…||Owned by:||xi|
Description (last modified by xi) (diff)
Hello, I'm looking for support, but I don't know if this is the right place to ask.
I'm using PyYAML to load some nested data from an utf-8 encoded file in Python with:
import yaml stream=file('data.yaml','r') data=yaml.load(stream)
The data variable becomes a dictionary with unicode values where is needed. What I want is to put utf-8 strings instead of unicode values to use this data with another library: Cheetah. If I try to use the unicode-type dictionary generated by default with PyYAML I get an UnicodeDecodeError, because de Cheetah strings are in iso-8859-15 and Python tries to decode them to Unicode using ASCII charset tables, so it obiously fails.
Is there any way to get an utf-8 coded dictionary?