View Single Post
Old 12-31-2012, 08:48 PM   #466
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: 7,627
Karma: 5433388
Join Date: Nov 2009
Device: many
Hi Sergey,

If you are not seeing the correct characters in the Log window when running the GUI, please try replacing the following class in Mobi_Unpack.pyw with the following:
Code:
# Wrap a stream so that output gets appended to shared queue
# using utf-8 encoding
class QueuedStream:
    def __init__(self, stream, q):
        self.stream = stream
        self.encoding = stream.encoding
        self.q = q
        if self.encoding == None:
            self.encoding = 'utf-8'
    def write(self, data):
        if isinstance(data,unicode):
            data = data.encode('utf-8',"replace")
        elif self.encoding != 'utf-8':
            udata = data.decode(self.encoding)
            data = udata.encode('utf-8', "replace")
        self.q.put(data)
    def __getattr__(self, attr):
        return getattr(self.stream, attr)

This should decode the stdout from the mobi_unpack.py (which will be in your local Russian code page) and encode it into utf-8 so that it should get written properly to the Log window (hopefully).

Please let me know if this helps.

Thanks,

KevinH
KevinH is offline   Reply With Quote