View Single Post
Old 09-26-2020, 12:55 PM   #1418
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by chaley View Post
I have never encountered code that messes so extensively with encodings like this plugin.
At the risk of me trying to "teach Granny how to suck eggs" ...

When I was migrating my own plugins to python3 I found these 2 items from polyglot.builtins very useful: as_unicode, as_bytes

After I'd finished I don't think I had any .encode(...) or .decode(...) code left to go wrong. However, (full disclosure) I only ever use calibre's current container class to do everything related to epub-wrangling, so it's quite likely Kovid has already catered for everything that's likely to go wrong encoding-wise.
jackie_w is offline   Reply With Quote