Since Python 3 str is Unicode and data sets might contain incorrect information regarding the string encoding, wrapping odil::Value::String in Python 3 should return a bytes object and not an str to avoid decoding exceptions.
Moreover odil::as_utf8 should be wrapped to facilitate the decoding when the data set is correct.
The wrapping of as_utf8 and friends is done in 7fbcf7bb00af159c2e500bd0c3da1519a4806fb4. As a bonus, odil.as_unicode will return a Python Unicode object, avoiding unicode(as_utf(...), "utf-8").
Since Python 3
str
is Unicode and data sets might contain incorrect information regarding the string encoding, wrappingodil::Value::String
in Python 3 should return abytes
object and not anstr
to avoid decoding exceptions.Moreover
odil::as_utf8
should be wrapped to facilitate the decoding when the data set is correct.Thanks to @ThibautSchmitt for the report.