[issue35140] encoding problem: gbk

2018-11-02 Thread Windson Yang
Windson Yang added the comment: It's fine @anmikf, keep practice :D. Let's recap what happened: Run encoding_problem_gbk.py on Windows10 using Python 3.7.0 will cause "SyntaxError: encoding problem: gbk". But it will run as expected if 1. The file has less than less than 15 lines. 2. Change

[issue35140] encoding problem: gbk

2018-11-02 Thread Tim Golden
Tim Golden added the comment: I'm afraid you'll have to use English in this forum so that all current and future readers have the best chance of understanding the situation. Thank you very much for making the effort this far. If anyone on this issue knows of a Chinese-language forum where

[issue35140] encoding problem: gbk

2018-11-02 Thread 安迷
安迷 added the comment: I'm sorry for my english. Can I use Chinese? -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue35140] encoding problem: gbk

2018-11-02 Thread 安迷
安迷 added the comment: this problem not exist on macOS. this problem not exist in python2. Windows10x64 Python 3.7.0 (v3.7.0:1bf9cc5093 script have no problem with 15 blank lines. script haveproblem with fist line '#coding:gbk' and 14 blank lines. --

[issue35140] encoding problem: gbk

2018-11-02 Thread Ma Lin
Ma Lin added the comment: Yes, I can reproduce on my Windows 10 (Simplfied Chinese). The file is a pure ASCII file, and doesn't have a BOM prefix. -- ___ Python tracker ___

[issue35140] encoding problem: gbk

2018-11-02 Thread Windson Yang
Windson Yang added the comment: Thank you, Lin. Can you reproduce on your machine, I guess it is related to terminal encoding or text file ending. However, I can't reproduce on macOS. -- ___ Python tracker

[issue35140] encoding problem: gbk

2018-11-02 Thread Ma Lin
Ma Lin added the comment: Let me give an explanation. Run encoding_problem_gbk.py, get an error: D:\>encoding_problem_gbk.py File "D:\encoding_problem_gbk.py", line 1 SyntaxError: encoding problem: gbk If remove the comment line, run as expected. -- nosy: +Ma Lin

[issue35140] encoding problem: gbk

2018-11-02 Thread Windson Yang
Windson Yang added the comment: If I understand your question correctly, you should save the file(the one contain Chinese chars) with GBK encoding using your editor. Otherwise, your editor would save it using the default encoding which led to python can't decode it correctly. --