1) declare coding
# -*- coding: utf-8 -*-
2) load file ( let's asume file is 'euc-kr')
fileData = f.read() # read from file
3) decode to unicode
unicodedata = unicode(fileData,"euc-kr")
4) encode 'utf-8'
utf8data = unicodedata.encode("utf-8")
5) set text
editor.setPlainText(utf8data) # editor is QTextEdit
** summary ** : converting flow
EUC-KR ---> UNICODE --> UTF-8
댓글 없음:
댓글 쓰기