detect_encoding doesn't work for UTF-32 encodings
When detect_encoding is run on utf-32 files it returns encoding as utf-16 instead of utf-32.
This is because byte order markers (for Little Endian) for UTF16 is b'\xff\xfe'
and for UTF32 is b'\xff\xfe\x00\x00'
and for UTF-32 encoded files detect_encoding reads the first 4 chars which are b'\xff\xfe\x00\x00'
Therefore we get a match for both UTF16 and UTF32 files since the data starts with both BOMS and it exits after matching with UTF16 BOM
Edited by Utkarsh Sharma