1

I am trying to force PhpStorm to encode newly created files as UTF-8, instead of Windows-1252 (which seems to be the default).

I know I can set "Project encoding" in "settings/editor/file encodings", which sets the default encoding for all newly created files in the current project.

However I'd like to set default encoding for new projects, so I will not have to change it every time I create a new project. I've searched far and wide on the internets, but with no success.

Do you guys know how to set file encoding for new projects?

Thanks in advance.

1
  • The IDE uses the default of the underlying operation system. And indeed many installations of MS-Windows still use totally outdated 8-bit encodings (like Windows-1252, which is close to ISO-latin1). Check if ou can switch the operating systems settings, so your file systems default encoding. Commented Feb 13, 2017 at 10:41

2 Answers 2

2

All available settings that are used as defaults for newly created projects can be set at File | Default Settings....

https://www.jetbrains.com/help/phpstorm/2016.3/accessing-default-settings.html

You can also access them directly from Welcome screen -- will be just Settings under Configure drop down (could be called Preferences on Mac -- cannot verify that as I have no Mac). But in this case default settings will be mixed with IDE-wide settings as well.

In both cases the options you need to change will be under Editor | File Encodings.

Sign up to request clarification or add additional context in comments.

2 Comments

I have to try it out, but it seems this is exactly what I was looking for. Thank you very much, you saved me a lot of trouble. (I always remember to set it to UTF-8 only after some file gets messed up by the wrong encoding :D )
It works -- I did set it up few years ago and still got UTF-8 in all new projects.
2

When creating new projects, you can set a proper IDE Encoding, its right next to the Project Encoding:

File Encodings PHPStorm

When you edit an existing project, it automatically recognizes the current encoding and offers you to convert/reload the project in a proper encoding.

1 Comment

I have IDE Encoding set to UTF-8, but whenever I create a new project, it is always created with Project Encoding - Windows 1252

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.