Pycharm adding mandatory BOM when creating files from terminal

After I updated Pycharm to version 2021.2, whenever I create a new .py file on Pycharm terminal with echo, I can't run it because of the following error:

SyntaxError: Non-UTF-8 code starting with '\xff' in file [file path...] on line 1, but no encoding declared;

 

After looking it up I'm convinced that pycharm is adding a mandatory BOM to the created file.

Things I tried:

Going to File -> File Properties -> Remove BOM (It's unable to remove)

Going to File -> File Properties -> File Encoding and changing it to UTF-8 (it gives me the following pop-up): 

Can't convert it either.

Going to Help -> Edit Custom VM Options and adding -Dconsole.encoding=UTF-8 to it

Creating a new python file by clicking works fine. Creating a new file with echo on cmd terminal works fine too.

What is causing this? How do I solve it? I didn't have this problem before updating Pycharm.

Thank you in advance.

Please sign in to leave a comment.