icalendar.parser_tools module#

icalendar.parser_tools.data_encode(data: str | bytes | dict | list, encoding='utf-8') bytes | List[bytes] | dict[source]#

Encode all datastructures to the given encoding. Currently unicode strings, dicts and lists are supported.

icalendar.parser_tools.from_unicode(value: str | bytes, encoding='utf-8') bytes[source]#

Converts a value to bytes, even if it already is bytes :param value: The value to convert :param encoding: The encoding to use in the conversion :return: The bytes representation of the value

icalendar.parser_tools.to_unicode(value: str | bytes, encoding='utf-8-sig') str[source]#

Converts a value to unicode, even if it is already a unicode string.