Skip to content

Instantly share code, notes, and snippets.

@vbalien
Last active May 9, 2016 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vbalien/f0ce99f193ce540e8f1563496fcdc8c7 to your computer and use it in GitHub Desktop.
Save vbalien/f0ce99f193ce540e8f1563496fcdc8c7 to your computer and use it in GitHub Desktop.
문자 byte배열 인코딩 타입 추측
def guess_encoding(text):
guess_list = ['euc-kr', 'utf-8', 'utf-16']
for best_enc in guess_list:
try:
str(text, best_enc, "strict")
except UnicodeDecodeError:
pass
else:
break
return best_enc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment