diff --git a/src/libprs500/__init__.py b/src/libprs500/__init__.py index 860581833f..af5c1e23e6 100644 --- a/src/libprs500/__init__.py +++ b/src/libprs500/__init__.py @@ -13,7 +13,7 @@ ## with this program; if not, write to the Free Software Foundation, Inc., ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ''' E-book management software''' -__version__ = "0.3.43" +__version__ = "0.3.44" __docformat__ = "epytext" __author__ = "Kovid Goyal " diff --git a/src/libprs500/ebooks/lrf/txt/convert_from.py b/src/libprs500/ebooks/lrf/txt/convert_from.py index 94f61a0978..2e8406b10d 100644 --- a/src/libprs500/ebooks/lrf/txt/convert_from.py +++ b/src/libprs500/ebooks/lrf/txt/convert_from.py @@ -87,8 +87,7 @@ def convert_txt(path, options): book.append(pg) lines = "" try: - lines = codecs.open(path, 'rb', 'ascii').readlines() - print 'huh' + lines = codecs.open(path, 'rb', options.encoding).readlines() except UnicodeDecodeError: try: lines = codecs.open(path, 'rb', 'cp1252').readlines() @@ -96,7 +95,13 @@ def convert_txt(path, options): try: lines = codecs.open(path, 'rb', 'iso-8859-1').readlines() except UnicodeDecodeError: - lines = codecs.open(path, 'rb', 'utf8').readlines() + try: + lines = codecs.open(path, 'rb', 'koi8_r').readlines() + except UnicodeDecodeError: + try: + lines = codecs.open(path, 'rb', 'koi8_u').readlines() + except UnicodeDecodeError: + lines = codecs.open(path, 'rb', 'utf8').readlines() for line in lines: line = line.strip() if line: