views:

1338

answers:

1

Hello,

I'm working on a winapp csproject using Visual Studio 2008 on Vista (polish locale) The problem appears when I build project on Win Server 2003 (english locale) - then polish diacritic is gone.

I investigated that the issue is caused by improper source file encoding. It looks that source files aren't in UTF-8. Is there a way to force VS to use Unicode always, instead of weird ISO-something?

Thanks in advance,

Tomasz

+2  A: 

Problem: Compiler launched from command line cannot process the source file because of international characters that I’ve just added.

Solution: Save source file explicitly in UTF-8 encoding to preserve international characters.

How To:

* open the problematic file in Visual Studio.
* on the File menu click “Advanced Save Options“
* from “Encoding” combo select “Unicode (UTF-8 …“
* click OK.

You’re set. Commit to please the build server and rest of the team waiting for green.

ruslander
I figured it out a few moments ago. I saved one file for test using 'UTF-with-BOM' and it fixed a couple of invalid strings. Is there any setting for Visual Studio to use UTF for all sources? It's really stupid to change it manually for a few hundred files.
tomo
There is a work around however - you can get visual studio to use a different encoding by setting the computers regional settings to, say, English for example. This would in turn force VS to use 'Western European - Codepade 1252' rather than 'Unicode UTF-8 - Codepage 65001'. Again, this works in the Express edition and I'm pretty sure it will in the full application.
ruslander
This workaround doesn't satisfy me. I set computer regional setting to polish on purpose so switching it is not an option. And switching to CP 1252 isn't an option too. I want to set explicitly CP65001.I spent some time for research and what I see it that VS 2008 templates are fine - they are all UTF-8 with BOM. The source of all evil are templates from sloppy coders from external components producers. Also recent release of ASP.NET MVC has this issue.
tomo