Sometimes people ask me how to let the Visual Studio remember the default text encoding when creating new file or adding new item to the projects. At first, I don’t know. VS always use the system default codepage settings for the new created files/items. After I met with this blog post, I finally got an answer for this question. Check it out!
ASP.NET Resources – Unicode in Visual Studio.NET 2003
If you don’t wanna read through this long post, I pull out the key section for you.
/! TO ALL THOSE ASKING HOW TO CHANGE DEFAULT ENCODING WHILE CREATING NEW FILE IN VISUAL STUDIO /!
Go to C:Program FilesMicrosoft Visual Studio .NET 2003VC#CSharpProjectItems (directory may vary depending on which VS version you have, and which project’s language you target), open the template you need to change (I needed to change JScript.js) in Visual Studio (or any other text editor I suppose?), and save it back to the encoding you want.
=> this will affect files you create while in a project, using Project > Add new item… (or right-clicking on the project tree > Add > Add new item…) (or Ctrl+Shift+A) (i think i said it all didn’t I?)
You can also go to C:Program FilesMicrosoft Visual Studio .NET 2003Common7IDENewScriptItems (or NewFileItems, depends what u wanna do), and to the same (open/save with encoding).
=> this will affect files you create using File > New > File…