ailon's DevBlog: Development related stuff in my life

File Encoding in Visual Studio

11/5/2007 3:43:02 PM

It appears that there's no way to set default file encoding for new files created in Visual Studio 2005 through "Options" and it will save your files in UTF only if it encounters characters it can't save in your systems default non-unicode locale.

What does it mean? It means that if you develop a simple web site in a language of your system (Lithuanian in my case) and you hardcode some local text in your .aspx it will save in non-unicode encoding (Windows-1257 in my case) and when you move it to the server (or other computer) with other default non-unicode encoding all your localized text will be ruined.

What can be done about it? It looks like we have 3 options:

  1. manually save or re-save your files using "Save with Encoding";
  2. change your system language to "English" in control panel (this is kind of wrong);
  3. re-save Visual Studio templates (in Common 7\IDE\ItemTemplates) in UTF-8 with signature

Only the last option somewhat solves the problem but you'll have to go through all of the templates you ever plan to use and hope that this doesn't break anything.

Hopefully this issue will be addressed in VS2008. I had no time to play with the betas yet, so I have no idea if there are any changes in this area. Can anybody confirm this?

Tags: , , ,

blog comments powered by Disqus
Copyright © 2003 - 2014 Alan Mendelevich
Powered by BlogEngine.NET 2.5.0.6