1

Basicly, I'm crawling text from a webpage with python using Beautifulsoup, then save it as an HTML and send it to my Kindle as a mail attachement. The problem is; Kindle supports Latin1(ISO-8859-1) encoding, however the text I'm parsing includes characters that are not a part of Latin1. So when I try to encode text as Latin1 python gives following error because of the illegal characters:

UnicodeEncodeError: 'latin-1' codec can't encode character u'\u2019' in position 17: ordinal not in range(256)

When I try to encode it as UTF-8, this time script runs perfectly but Kindle replaces some incompatible characters with gibberish.

user1599986
  • 31
  • 1
  • 6
  • Maybe you should post the code, if you want us to help you fix it. – Daniel Roseman Aug 31 '15 at 17:16
  • What Kindle version are you using? It seems that Unicode is supported starting from version 3 (see [here](https://www.goodreads.com/author_blog_posts/5809778-kindle-support-for-unicode-pt1-dispelling-a-myth)). – lenz Aug 31 '15 at 17:33

1 Answers1

0

Use <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

I previously used <meta charset="UTF-8" />, which did not seem to work.

Daniel Apt
  • 2,468
  • 1
  • 21
  • 34