# pydicom.charset.decode_bytes

pydicom.charset.decode_bytes(value: bytes, encodings: Sequence[str], delimiters: set[int]) → str

  Decode an encoded byte value into a unicode string using encodings.

  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 `reading_validation_mode` is not `RAISE`, a warning is issued, and value is decoded using the first encoding with replacement characters, resulting in data loss.

  Return type:

    str

  Raises:

    - UnicodeDecodeError – If `reading_validation_mode` is `RAISE` and value could not be decoded with the given encodings.

    - LookupError – If `reading_validation_mode` is `RAISE` and the given encodings are invalid.