pydicom.charset.decode_bytes¶
-
pydicom.charset.
decode_bytes
(value: bytes, encodings: List[str], delimiters: Set[int]) → str[source]¶ Decode an encoded byte value into a unicode string using encodings.
New in version 1.2.
- Parameters
value (bytes) – The encoded byte string in the DICOM element value.
encodings (list of str) – The encodings needed to decode the string as a list of Python encodings, converted from the encodings in (0008,0005) Specific Character Set.
delimiters (set of int) – A set of characters or character codes, each of which resets the encoding in value.
- Returns
The decoded unicode string. If the value could not be decoded, and
enforce_valid_values
isFalse
, a warning is issued, and value is decoded using the first encoding with replacement characters, resulting in data loss.- Return type
- Raises
UnicodeDecodeError – If
enforce_valid_values
isTrue
and value could not be decoded with the given encodings.