forked from Krautspace/doorstatus
27 lines
555 B
Python
27 lines
555 B
Python
|
import sys
|
||
|
|
||
|
def byteorder():
|
||
|
return sys.byteorder
|
||
|
|
||
|
def standart_encoding():
|
||
|
return sys.getdefaultencoding()
|
||
|
|
||
|
def standart_ausgabeencoding():
|
||
|
return sys.stdout.encoding()
|
||
|
|
||
|
def string2bytes(text):
|
||
|
try:
|
||
|
bytestream = bytes(text, "utf-8")
|
||
|
except Exception as e:
|
||
|
print('string2bytes: error: {}'.format(e))
|
||
|
return
|
||
|
return bytestream
|
||
|
|
||
|
def bytes2string(bytes):
|
||
|
try:
|
||
|
text = str(bytes, "utf-8")
|
||
|
except Exception as e:
|
||
|
print('bytes2string: error: {}'.format(e))
|
||
|
text = ''
|
||
|
return text
|