mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fixes to encoding handling in txt2lrf.
This commit is contained in:
parent
5852f04428
commit
2a1edb45c6
@ -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 <kovid@kovidgoyal.net>"
|
||||
|
||||
|
@ -87,14 +87,19 @@ 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()
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
lines = codecs.open(path, 'rb', 'iso-8859-1').readlines()
|
||||
except UnicodeDecodeError:
|
||||
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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user