Thread: ePUB Optimizer
View Single Post
Old 01-02-2018, 05:45 PM   #121
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,809
Karma: 6000000
Join Date: Nov 2009
Device: many
Note, filesystem/path encodings in Python can differ greatly on Windows from the utf-8 standard used on Linux and Macs.

So if you are trying to convert a bytestring in Python that contains a path or partial path to full unicode you should probably decode it using sys.getfilesystemencoding() to create a full unicode string and then encode that into utf-8 for printing.

Alternatively, you can use 'replace' with decode and encode routines to prevent problems with unknown bytestrings.

See my unipath.py code here for routines for fighting this battle:

https://github.com/Sigil-Ebook/Sigil...hon/unipath.py
KevinH is offline   Reply With Quote