danslimmon/oscar

UnicodeEncodeError

guinhas opened this issue · 1 comments

Hi,

First of all, CloCkWeRX, bergkoet, skrobul, danslimmon, digital-shokunin, you guys are awesome, thank you very much for Oscar!
After I add an item with a description like água or camarão to oscar_db, when I try to add those items to the Groceries list, I get an UnicodeEncodeError. If I add agua or camarao, it all works out ok. The strange characters are the problem, but I don't know what to do. The log looks like this:

Traceback (most recent call last):
File "/var/oscar/scan.py", line 239, in
add_grocery_item(trello_api, barcode_rule)
File "/var/oscar/scan.py", line 195, in add_grocery_item
print "Adding '{0}' to grocery list".format(item["item"])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 0: ordinal not in range(128)

Thank you very much for your help and again, thank you very much for your work.

Never mind, I solved it by adding .encode('utf8'), like this: print "Adding '{0}' to grocery list".format(item["item"].encode('utf8')). Then I got a KeyError: 'description', but I just disabled digit-eyes with zeroapi, and now everything is working. Again, thank you all very much for Oscar.