vijfhoek / telematrix

Bridge between Telegram and Matrix
MIT License
98 stars 19 forks source link

Unexpected error receiving message #46

Open turt2live opened 7 years ago

turt2live commented 7 years ago
ERROR:aiohttp.web:Error handling request
Traceback (most recent call last):
  File "/root/telematrix/venv/lib/python3.5/site-packages/aiohttp/server.py", line 261, in start
    yield from self.handle_request(message, payload)
  File "/root/telematrix/venv/lib/python3.5/site-packages/aiohttp/web.py", line 88, in handle_request
    resp = yield from handler(request)
  File "/root/telematrix/telematrix/__init__.py", line 216, in matrix_transaction
    .format(user_id), None)
  File "/root/telematrix/telematrix/__init__.py", line 352, in _matrix_request
    return await response.json()
  File "/root/telematrix/venv/lib/python3.5/site-packages/aiohttp/client_reqrep.py", line 789, in json
    return loads(stripped.decode(encoding))
  File "/root/telematrix/venv/lib/python3.5/encodings/cp1254.py", line 15, in decode
    return codecs.charmap_decode(input,errors,decoding_table)
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 25: character maps to <undefined>

I don't know the message that caused this, just that it doesn't allow the bridge to work.

14mRh4X0r commented 7 years ago

From what I can see, somehow your homeserver says the response is in Windows-1254 encoding, while responding with (probably) UTF-8. A hotfix would probaby be to replace return await response.json() with return await response.json(encoding='utf-8').