thegetty/pyalma

encoding for items with diacritics

Opened this issue · 0 comments

FYI, was getting the following error when dealing with an item with an Author name that had a diacritic.

UnicodeEncodeError: 'latin-1' codec can't encode character '\u0301' in position 377: Body ('́') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.

Was able to get the item without issue, but making a change to the barcode then putting the item led to the error. I edited put_item to have data become data.encode('utf-8') and all worked well.

May want to consider an encoding parameter (besides xml and json) for this type of pass in too.