pydicom.charset.encode_string¶
- pydicom.charset.encode_string(value: str, encodings: Sequence[str]) bytes [source]¶
Encode a unicode string value into
bytes
using encodings.- Parameters:
- Returns:
The encoded string. If value could not be encoded with any of the given encodings, and
reading_validation_mode
is notRAISE
, a warning is issued, and value is encoded using the first encoding with replacement characters, resulting in data loss.- Return type:
- Raises:
UnicodeEncodeError – If
writing_validation_mode
is set toRAISE
and value could not be encoded with the supplied encodings.