mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Prevent Content-Transfer-Enconding headers from confusing encoding detection in the diff tool
This commit is contained in:
parent
cd32ca094a
commit
8dbaf101ec
@ -109,7 +109,7 @@ def get_decoded_raw(name):
|
|||||||
raw = xml_to_unicode(raw, verbose=True)[0]
|
raw = xml_to_unicode(raw, verbose=True)[0]
|
||||||
else:
|
else:
|
||||||
m = re.search(r"coding[:=]\s*([-\w.]+)", raw[:1024], flags=re.I)
|
m = re.search(r"coding[:=]\s*([-\w.]+)", raw[:1024], flags=re.I)
|
||||||
if m is not None:
|
if m is not None and m.group(1) != '8bit':
|
||||||
enc = m.group(1)
|
enc = m.group(1)
|
||||||
else:
|
else:
|
||||||
enc = force_encoding(raw, verbose=True)
|
enc = force_encoding(raw, verbose=True)
|
||||||
@ -137,6 +137,7 @@ def dir_diff(left, right):
|
|||||||
path = os.path.join(dirpath, filename)
|
path = os.path.join(dirpath, filename)
|
||||||
name = os.path.relpath(path, base)
|
name = os.path.relpath(path, base)
|
||||||
data[name], smap[name] = get_decoded_raw(path)
|
data[name], smap[name] = get_decoded_raw(path)
|
||||||
|
print (1111111, name, type(data[name]))
|
||||||
cache, changed_names, renamed_names, removed_names, added_names = changed_files(
|
cache, changed_names, renamed_names, removed_names, added_names = changed_files(
|
||||||
ldata, rdata, ldata.get, rdata.get)
|
ldata, rdata, ldata.get, rdata.get)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user