Skip to content

Commit

Permalink
Prevent Content-Transfer-Enconding headers from confusing encoding de…
Browse files Browse the repository at this point in the history
…tection in the diff tool
  • Loading branch information
kovidgoyal committed Jun 17, 2014
1 parent cd32ca0 commit 8dbaf10
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/calibre/gui2/tweak_book/diff/main.py
Expand Up @@ -109,7 +109,7 @@ def get_decoded_raw(name):
raw = xml_to_unicode(raw, verbose=True)[0]
else:
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)
else:
enc = force_encoding(raw, verbose=True)
Expand Down Expand Up @@ -137,6 +137,7 @@ def dir_diff(left, right):
path = os.path.join(dirpath, filename)
name = os.path.relpath(path, base)
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(
ldata, rdata, ldata.get, rdata.get)

Expand Down

0 comments on commit 8dbaf10

Please sign in to comment.