Open GoogleCodeExporter opened 9 years ago
Rob,
This was introduced in 0.9.8 as we strive toward python 3 compatibility. The
biggest thing in python 3 is converting between raw bytes and string literals.
We actually perform this conversion inside of DataElement_from_raw.
Internally when we use DataElement_from_raw, the second argument is the
specific character set for the containing Dataset (Dataset._character_set). In
many cases, the default_encoding should work (iso8859) but it will definitely
fail in some.
All that being said. Our goal with 0.9.8 was to add python 3 compatibility
without drastically altering the expected behavior in python 2. In python 2, we
don't actually convert from string literals to unicode in DataElement_from_raw,
so really the encoding parameter is unnecessary. However, that also means that
the default value for the encoding parameter should not result in an exception.
I'll have to think about what the default value should be (because we want to
force python 3 users to enter a value still), but in the meantime as
work-around, you can pass either ds._character_set or
dicom.charset.default_encoding as the second parameter.
-Jonathan
Original comment by Suever@gmail.com
on 5 Feb 2013 at 4:41
Original issue reported on code.google.com by
barlen...@gmail.com
on 5 Feb 2013 at 3:59