0

Hi I am trying to work with an SQLite database using Python, however, the data has a lot of obscure characters (chinese / japanese letters etc.) and as a result my outputs contain a lot of 'UnicodeEncodeError: 'charmap' codec can't encode character' errors.

When I try and encode the outputs to resolve this, I then get the following error:

'AttributeError: 'tuple' object has no attribute 'encode''

Any ideas on how I get around this?

mclapham
  • 43
  • 4
  • 1
    You have to call it on the strings inside of the `tuple` because just as the errors say, `tuple` doesn't have the attribute `encode`, the strings however should. – Hampus Larsson May 13 '20 at 14:28
  • 1
    If the "charmap" errors occur when printing or writing to file, take a look at this https://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console – snakecharmerb May 13 '20 at 14:38
  • @HampusLarsson this is my first proper Python project so I'm afraid I'm a bit of a rookie! How would exactly would i go about encoding the strings and not the tuple? – mclapham May 13 '20 at 14:47

0 Answers0