UnicodeDecodeError: 'utf8' codec can't decode byte 0xed in position 14: invalid continuation byte

92 views
Skip to first unread message

Gabor Nyul

unread,
Oct 21, 2016, 4:54:48 PM10/21/16
to web2py-users
I have an MSSQL database with data stored in Hungarian charset.
I've tried to use the DataTables example from here:http://www.web2pyslices.com/slice/show/2052/using-datatablesnet-with-web2py-for-ultra-fast-grid-display but I'v got this error.
UnicodeDecodeError: 'utf8' codec can't decode byte 0xed in position 14: invalid continuation byte
The database request went well, I can see the returned data although already unicode encoded in the error ticket.
Here is the beginning of the returned data where you can see the accented character escapes : ((self=<json.encoder.JSONEncoder object>, o=[{'ARAMNEM_NEV': 'nincs villamos\xedtva', ....)

The view is almost exactly the same as in the link of slice above.

Controller:
def index():
    import json
    res = json.dumps(db.executesql('select * from bd_aramnemek', as_dict = True))
    return dict(results=XML(res))

What should I do to get back the native chars stored in the DB?
Reply all
Reply to author
Forward
0 new messages