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 346cc04 commit d071325Copy full SHA for d071325
src/inputstream.py
@@ -123,14 +123,16 @@ def detectBOM(self):
123
string = self.rawStream.read(4)
124
125
# Try detecting the BOM using bytes from the string
126
- encoding = bomDict.get(string[:3]) # UTF-8
+ encoding = bomDict.get(string[:3]) # UTF-8
127
seek = 3
128
if not encoding:
129
- encoding = bomDict.get(string[:2]) # UTF-16
130
- seek = 2
+ # Need to detect UTF-32 before UTF-16
+ encoding = bomDict.get(string) # UTF-32
131
+ seek = 4
132
- encoding = bomDict.get(string) # UTF-32
133
- seek = 4
+ encoding = bomDict.get(string[:2]) # UTF-16
134
+ seek = 2
135
+
136
137
#AT - move this to the caller?
138
# Set the read position past the BOM if one was found, otherwise
0 commit comments