From dfe83e5fcdb5cc48880fda91d3d78353cb6ce4f7 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Sat, 25 May 2013 01:31:27 +0000 Subject: Make UTF-8 detection more robust. If the 1st line of the Python is blank/empty, the function assumes that the encoding is 'ascii' and doesn't try for the 2nd line. --- coverage/phystokens.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coverage/phystokens.py') diff --git a/coverage/phystokens.py b/coverage/phystokens.py index 166020e..df569fc 100644 --- a/coverage/phystokens.py +++ b/coverage/phystokens.py @@ -188,7 +188,7 @@ def source_encoding(source): bom_found = True first = first[3:] default = 'utf-8-sig' - if not first: + if first is None: return default encoding = find_cookie(first) -- cgit v1.2.1