More a note to myself, because I’m sure, will bump again in this issue later.
I’ve edited some strings in our XAML files to correct some french words. Someone pointed that I’m not playing well with french-specific characters (you now, the é, è, à, …). After committing my changes our build server went down with a strange error:
error MC3000: ‘Invalid character in the given encoding. Line 58, position 47.’ XML is not valid.
Hmm. On my machine VS has built and run it without any problems. Compiling from command line – same error.
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.

3 comments
Comments feed for this article
January 21, 2010 at 09:01
Guido
Hi Valeriu,
thanks for this piece of information.
In my personal experience there is one caveat with this approach:
Changing the character encoding of files under source control in an TFS / VS 2008 environment can lead to problems in comparing and merging the file if this file was checked out by others during the encoding change.
If only a few characters need to be taken from unicode, you could also reference them by their unicode entity name (e.g. “●” for the Password Character in Password box styles).
Regards,
Guido
January 21, 2010 at 09:25
Valeriu Caraulean
Thank you Guido, haven’t knew that there can be issues with TFS.
As for replacing only individual characters with unicode representations – that’s a nice trick. But it’s a “no way” if you have to internationalize your application.
January 21, 2010 at 09:03
Guido
the entitiy name above should read: “[ampersand]#x25CF;” .
/
Grmpfl