Skip to content

Commit

Permalink
Use more data when trying to determine encoding.
Browse files Browse the repository at this point in the history
32 bytes wasn't resulting in the wrong determination being made in more
situations than acceptable.  Bumped it up to 4K since most filesystem
reads are at least that size.
  • Loading branch information
jszakmeister committed Jan 18, 2020
1 parent b6679ad commit 8e41997
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion markdown2ctags.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ScriptError(Exception):

def detect_encoding(filename):
with open(filename, 'rb') as f:
raw = f.read(32)
raw = f.read(4096)

potential_bom = raw[:4]
bom_encodings = [('utf-8-sig', codecs.BOM_UTF8),
Expand Down

0 comments on commit 8e41997

Please sign in to comment.