Skip to content

Instantly share code, notes, and snippets.

@kotobukid
Created October 3, 2012 14:22
Show Gist options
  • Save kotobukid/3827178 to your computer and use it in GitHub Desktop.
Save kotobukid/3827178 to your computer and use it in GitHub Desktop.
いつも悩むエンコード・デコード関係のメモ
#coding: utf-8
f = open('utf-8.html')
text = f.read()
f.close()
print text.decode('utf-8').encode('sjis')
#a = unicode(text, 'utf-8')
#a = u'こんにちは'
#print a.encode('sjis')
#print unicode(text, 'utf-8').decode('cp932')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment