[cmake-developers] [CMake 0012075]: generated .vcproj with wrong encoding
Mantis Bug Tracker
mantis at public.kitware.com
Wed Apr 13 04:36:52 EDT 2011
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=12075
======================================================================
Reported By: zouguangxian
Assigned To:
======================================================================
Project: CMake
Issue ID: 12075
Category: CMake
Reproducibility: always
Severity: major
Priority: high
Status: new
======================================================================
Date Submitted: 2011-04-13 04:36 EDT
Last Modified: 2011-04-13 04:36 EDT
======================================================================
Summary: generated .vcproj with wrong encoding
Description:
for example, in Source\cmGlobalVisualStudio7Generator.cxx:
line 636
//----------------------------------------------------------------------------
std::string
cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget* target)
{
std::string pname = target->GetName();
pname += "_UTILITY";
std::string fname = target->GetMakefile()->GetStartOutputDirectory();
fname += "/";
fname += pname;
fname += ".vcproj";
cmGeneratedFileStream fout(fname.c_str());
fout.SetCopyIfDifferent(true);
this->CreateGUID(pname.c_str());
std::string guid = this->GetGUID(pname.c_str());
fout <<
"<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
the encoding always be "Windows-1252", but if the path include chinese
characteres, the generated .vcproj can't be open correctly in Visual Studio.
Additional Information:
the solution is:
1. determine the codepage
2. set the correct encoding.
like the following:
std::string guid = this->GetGUID(pname.c_str());
std::string encoding = "Windows-1252";
switch(_getmbcp())
{
case 936:
encoding = "gb2312";
break;
default:
break;
}
fout <<
"<?xml version=\"1.0\" encoding = \"" << encoding << "\"?>\n"
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2011-04-13 04:36 zouguangxian New Issue
======================================================================
More information about the cmake-developers
mailing list