View Single Post
Old 07-15-2015, 05:55 PM   #1182
jemc
Quietly Lurking...
jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.jemc ought to be getting tired of karma fortunes by now.
 
jemc's Avatar
 
Posts: 169
Karma: 2514918
Join Date: Dec 2009
Location: Wherever life takes me...
Device: Kindles, iDevices, others
Quote:
Originally Posted by KevinH View Post
Hi jemc,

To be honest, I am not sure how to best work around it. Your cp437 encoding just has no character that represents the copyright character and therefore any attempt to convert to your encoding from full unicode will fail. I have to look to see if the codec automatic output encoding setting allows for fallback replacement of some sort. I know if I convert each string manually in python, it does allow for fallback replacement but that kind of defeats the whole purpose of using the output codecs for sys.stdout

A better long term solution for you may be to get a shell/terminal program that supports the utf-8 encoding. This is standard on all Linux, and Mac OS X systems. There is code in Kindleunpack that enables the Windows cp equivalent to utf-8 but users must enable that encoding for it to work. I have heard that using the windows cp equivalent to utf-8 causes issues on some older Windows systems. I have no idea how well it works on newer Windows 8.1 or later systems.

Alternatively,you could always use the gui as it provides a full utf-8 terminal scroll pane window.

You mentioned a workaround of your own? What is it?

Thanks,

KevinH
Hi Kevin,

No problem - I didn't mean for you to spend so much time on this. Normally I use kindleunpack embedded inside another program I wrote that allows me to automate some text processing tasks, run kindlegen and finally run kindleunpack to split out the mobi8 file. I have each process dumping their output (stdout & stderr) to log files for later review. This still works fine. I ran across the above mentioned bug when I was testing some text processing changes I'd made while running kindlegen.py via command-line without redirecting the output. Anyway after checking everything on my end my first workaround was 'don't do that'. After you told me what was triggering the crash, I edited the code to change the copyright character to (C) in my copy of the code. Works fine now so I'm good. FYI: I've tripped over this problem over the years so tend to go 'kiss' with message text in direct command-line interfaces.

Again, thanks for your help!
Best,
jemc

Last edited by jemc; 07-15-2015 at 07:15 PM.
jemc is offline   Reply With Quote