Author 王杰
Recipients 王杰
Date 2015-12-24.03:49:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450928989.2.0.861306801503.issue25937@psf.upfronthosting.co.za>
In-reply-to
Content
I use CentOS 7.0 and change LANG=gbk.

I has a file "gbk-utf-8.py" and it's encoding is GBK.

# -*- coding:utf-8 -*-
import chardet
if __name__ == '__main__':
    s = '中文'
    print s, chardet.detect(s) 

I execute it and everything is ok. However it raise "SyntaxError" (as I expected) after I change "encoding:utf-8" to "encoding:utf8".

  File "gbk-utf8.py", line 2
SyntaxError: 'utf8' codec can't decode byte 0xd6 in position 0: invalid continuation byte

Is this ok? Or where I wrong?
History
Date User Action Args
2015-12-24 03:49:49王杰setrecipients: + 王杰
2015-12-24 03:49:49王杰setmessageid: <1450928989.2.0.861306801503.issue25937@psf.upfronthosting.co.za>
2015-12-24 03:49:49王杰linkissue25937 messages
2015-12-24 03:49:48王杰create