Open l-portugal opened 3 years ago
Try to change decode params of method get_python_value in routeros_api/api_structure.py There is bytes.decode() by default. Try bytes.decode('cp1251')
def get_python_value(self, bytes):
return bytes.decode('cp1251')
Try to change decode params of method get_python_value in routeros_api/api_structure.py There is bytes.decode() by default. Try bytes.decode('cp1251')
def get_python_value(self, bytes): return bytes.decode('cp1251')
Thanks skeapskeap. I solve it changing bytes.decode() to bytes.decode("utf-8", "ignore")
routeros_api/api_structure.py:
def get_python_value(self, bytes):
return bytes.decode("utf-8", "ignore")
thanks
I have the same issue, thank you for your comment.
Try to change decode params of method get_python_value in routeros_api/api_structure.py There is bytes.decode() by default. Try bytes.decode('cp1251')
def get_python_value(self, bytes): return bytes.decode('cp1251')
Thanks skeapskeap. I solve it changing bytes.decode() to bytes.decode("utf-8", "ignore")
routeros_api/api_structure.py:
def get_python_value(self, bytes): return bytes.decode("utf-8", "ignore")
thanks
I had the same problem, patched it on my side using: return bytes.decode('iso-8859-1')
but would like an official fix.
My script obtain a list of DHCP Server leases. When i run the script, this show the error:
"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 6: invalid continuation byte"
the command is :
cmd = api.get_resource('/ip/dhcp-server/lease') leases = cmd.get()
In leases, some characters in "host-name" field they may be: á,é,í,ó,ú
is there any way to fix this error without change the characters in host-name field?
The script is in python3.
Thanks.