New submission from 王杰:

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?

----------
messages: 256952
nosy: 王杰
priority: normal
severity: normal
status: open
title: DIfference between utf8 and utf-8 when i define python source code 
encoding.

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25937>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to