Can I modify the encoding of the hardcoded charset file by modify ENCODING_PATTERN of pycharm-openapi-src/PythonFileType
My python file is start by # -*- coding: utf-8 -*- ,but the file`s encoding is gbk,chinese is garbled.
like this

I want to change file encoding to gbk,but i cant modify file coding,because the file is recognized as hardcoded。

So, I would like to avoid this problem by modifying the hardcoded recognition rules.
But after I modified ENCODING_PATTERN of pycharm-openapi-src/PythonFileType no effect.
2022_08_08_afMhyzkNsWboA6cg7tKikm
This is my upload ID, testcodtype.rar is the compressed package of the project, Untitled-1.py is the file in question, it is also in testcodtype.rar, you can try to open Untitled-1 with pycharm first, if you can't reproduce, you can try to unzip testcodtype.rar and import it in pycharm to check,thanks
Please sign in to leave a comment.
my pycharm version is 221.5591.52,thank you very much
Hi, the issue is not reproducible for me, unfortunately. Pasting the following snippet shows correctly in PyCharm
Please provide more specific steps to reproduce the issue, if known.
Also, please provide `idea.log` file from the logs directory
You can use uploading service at https://uploads.jetbrains.com/ , and provide upload ID in your reply.
2022_08_08_afMhyzkNsWboA6cg7tKikm
This is my upload ID, testcodtype.rar is the compressed package of the project, Untitled-1.py is the file in question, it is also in testcodtype.rar, you can try to open Untitled-1 with pycharm first, if you can't reproduce, you can try to unzip testcodtype.rar and import it in pycharm to check
Thank you, seems to be some kind of bug. I submitted a report -- https://youtrack.jetbrains.com/issue/IDEA-299754/Unable-to-modify-file-encoding-in-the-IDE
Please follow it for updates.
I have another question, can I fix it by modifying
ENCODING_PATTERN of \src\com\jetbrains\python\PythonFileType.java in lib\src\pycharm-openapi-src.zip to temporarily solve this problem
and Can you tell me what pycharm-openapi-src.zip is used for
I Know what shoudle I do, thanks for your help.