[cmake-developers] Question regarding [58e3d49] MSVC: Fix encoding of Visual Studio 10+ project files

Clinton Stimpson clinton at elemtech.com
Thu Mar 6 10:15:43 EST 2014


On Thursday, March 06, 2014 11:09:24 AM Dominik Bernhardt wrote:
> Hi,
> 
> I have a question regarding the change [58e3d49] that changed the
> encoding of generated visual studio project files from utf-8 to
> Windows-1252.
> Although the encoding header in the generated xml file was changed the
> files are still written as utf. Visual Studio does not complain about
> that fact. However If I try to parse the xml file with some other xml
> parsers they will complain about that encoding mismatch.
> What was the reason to change the encoding from utf-8 to Windows-1252?
> 
> Dominik

Hi,

CMake's internal encoding on Windows is currently ANSI, not UTF-8.
So the generated xml file should actually be ANSI, even if the xml header used 
to say "UTF-8."

I do realize that setting the encoding to "Windows-1252" encoding is not 
entirely correct, even for ANSI, but it was an improvement.  Previously, only 
the 7-bit ASCII subset of strings were allowed to be written out by CMake to 
the xml file with a utf-8 header, and still have a valid xml file.

With that commit, a the larger 8-bit Latin-1 set of characters can be written 
out and still have a valid xml file, which helps the Western European 
languages, but still not other parts of the world.  The other parts of the 
world should still have the same limitation as before, when the header said it 
was a UTF-8 file.

There has been work going into CMake to support a UTF-8 encoding on Windows, 
but it is not complete.

- Clint



More information about the cmake-developers mailing list