Powered by Tachyonic Project Luxon Framework v0.0.0

Luxon Framework for rapid application development. (luxon)

Version

Encoding Utility

Bytes to Unicode

luxon.utils.encoding.if_bytes_to_unicode(string, codec='UTF-8')[source]

Decode UTF-8 Bytes to string UTF8.

Parameters:
  • string (bytes) – Bytes String
  • codec (str) – Codec type
Returns:

Unicode string

Unicode to Bytes

luxon.utils.encoding.if_unicode_to_bytes(string, codec='UTF-8')[source]

Encode if Unicode to Bytes UTF8.

Parameters:
  • string (bytes) – Bytes String
  • codec (str) – codec type
Returns:

UTF8 encoded string

ASCII Check

luxon.utils.encoding.is_ascii(string)[source]

Check if argument encodes to ascii without error.

Parameters:string (str) – string of bytes
Returns:True if string can successfully be encoded

Binary Check

luxon.utils.encoding.is_binary(data)[source]

Is Binary?

Parameters:data (str/bytes) – Possible binary or string.
Returns:True if binary.

Text Check

luxon.utils.encoding.is_text(text)[source]

Is Text?

Parameters:text (str/bytes) – Socket path.
Returns:True if text.

UTF-8 Check

luxon.utils.encoding.is_utf8(string)[source]

Check if argument encodes to UTF8 without error.

Parameters:string (str) – string of bytes
Returns:True if string can be successfully encoded