mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix 0 case in rtf cp + case when there is no pictures in a file
This commit is contained in:
parent
5873c1e35a
commit
6e831360a2
@ -101,7 +101,7 @@ class DefaultEncoding:
|
||||
break
|
||||
if self.__token_info == 'cw<ri<ansi-codpg':
|
||||
#cw<ri<ansi-codpg<nu<10000
|
||||
self.__code_page = line[20:-1] if line[20:-1] \
|
||||
self.__code_page = line[20:-1] if int(line[20:-1]) \
|
||||
else '1252'
|
||||
if self.__token_info == 'cw<ri<macintosh_':
|
||||
self.__platform = 'Macintosh'
|
||||
@ -120,7 +120,9 @@ class DefaultEncoding:
|
||||
fenccp = re.compile(r'\\ansicpg(\d+)[\\ \{\}\t\n]+')
|
||||
for line in read_obj:
|
||||
if fenccp.search(line):
|
||||
self.__code_page = fenccp.search(line).group(1)
|
||||
cp = fenccp.search(line).group(1)
|
||||
if not int(cp):
|
||||
self.__code_page = cp
|
||||
break
|
||||
if fenc.search(line):
|
||||
enc = fenc.search(line).group(1)
|
||||
|
@ -168,7 +168,10 @@ class Pict:
|
||||
copy_obj = copy.Copy(bug_handler = self.__bug_handler)
|
||||
if self.__copy:
|
||||
copy_obj.copy_file(self.__write_to, "pict.data")
|
||||
copy_obj.copy_file(self.__pict_file, "pict.rtf")
|
||||
try:
|
||||
copy_obj.copy_file(self.__pict_file, "pict.rtf")
|
||||
except:
|
||||
pass
|
||||
copy_obj.rename(self.__write_to, self.__file)
|
||||
os.remove(self.__write_to)
|
||||
if self.__pict_count == 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user