This document describes the current stable version of Kombu (4.2). For development docs, go here.

String Encoding Utilities - kombu.utils.encoding

Text encoding utilities.

Utilities to encode text, and to safely emit text from running applications without crashing from the infamous UnicodeDecodeError exception.


Convert bytes to str.

kombu.utils.encoding.default_encode(obj, file=None)[source]

Get default encoding.


Get default encoding.

kombu.utils.encoding.default_encoding_file = None

safe_str takes encoding from this file by default. set_default_encoding_file() can used to set the default output file.


Convert str to bytes.

kombu.utils.encoding.from_utf8(s, *args, **kwargs)[source]

Convert utf-8 to ASCII.


Get file used to get codec information.

kombu.utils.encoding.safe_repr(o, errors=u'replace')[source]

Safe form of repr, void of Unicode errors.

kombu.utils.encoding.safe_str(s, errors=u'replace')[source]

Safe form of str(), void of unicode errors.


Set file used to get codec information.


Convert str to bytes.