Created
April 16, 2023 09:24
-
-
Save Rahmanism/b8791833170237019158434dbc0168a5 to your computer and use it in GitHub Desktop.
Find the encoding of a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, chardet | |
with open(sys.argv[1], 'rb') as f: | |
result = chardet.detect(f.read()) | |
print(result['encoding']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment