self.hdf.setValue(prefix.encode('utf-8'), value.encode('utf-8'))
This is not the appropriate way to do it.
While it might still work that way (testing if prefix
is an unicode
object, then only in this case try to encode it), it's much safer to use the HDFWrapper API, which has been strengthened to allow mixed str
/unicode
usage (see source:tags/trac-0.10/trac/web/clearsilver.py):
req.hdf[prefix] = value
In general, you can find good advice (I hope ;) ) about usage of Unicode within Trac 0.10 in TracDev/UnicodeGuidelines.