We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b816a0a commit 3b6946aCopy full SHA for 3b6946a
pygccxml/parser/declarations_cache.py
@@ -23,8 +23,16 @@ def file_signature( filename ):
23
# - This change allows duplicate autogenerated files to be recognized
24
#return os.path.getmtime( source )
25
sig = hashlib.md5()
26
- f = open(filename,'r')
27
- sig.update(f.read().encode('utf-8'))
+ try:
+ # try default encoding first
28
+ f = open(filename, 'r', encoding='utf-8')
29
+ buf = f.read()
30
+ except UnicodeDecodeError:
31
+ # otherwise, try another common encoding
32
+ f.close()
33
+ f = open(filename, 'r', encoding='iso8859-1')
34
35
+ sig.update(buf.encode('utf-8'))
36
f.close()
37
return sig.hexdigest()
38
0 commit comments