diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2016-11-01 22:35:23 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2016-11-02 14:48:34 (GMT) |
commit | baead1e2a8ff7938f6be9c5fc01762edddd2ace9 (patch) | |
tree | 100e2a6a9478a796dc33c31da94ec828239330ef /Source/CPack/WiX/cmWIXSourceWriter.cxx | |
parent | 713424ad207aa0f5e01f8c16b2ee1c442a91893a (diff) | |
download | CMake-baead1e2a8ff7938f6be9c5fc01762edddd2ace9.zip CMake-baead1e2a8ff7938f6be9c5fc01762edddd2ace9.tar.gz CMake-baead1e2a8ff7938f6be9c5fc01762edddd2ace9.tar.bz2 |
Encoding: Remove option to use ANSI code page internally
The switch to use UTF-8 encoding has been defaulted to on for quite some
time since commit v3.2.0-rc1~116^2 (Encoding: Switch to use UTF-8
internally by default on Windows, 2014-12-26).
Diffstat (limited to 'Source/CPack/WiX/cmWIXSourceWriter.cxx')
-rw-r--r-- | Source/CPack/WiX/cmWIXSourceWriter.cxx | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index a8b0d7c..b434334 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -117,9 +117,7 @@ void cmWIXSourceWriter::AddProcessingInstruction(std::string const& target, void cmWIXSourceWriter::AddAttribute(std::string const& key, std::string const& value) { - std::string utf8 = CMakeEncodingToUtf8(value); - - File << " " << key << "=\"" << EscapeAttributeValue(utf8) << '"'; + File << " " << key << "=\"" << EscapeAttributeValue(value) << '"'; } void cmWIXSourceWriter::AddAttributeUnlessEmpty(std::string const& key, @@ -130,43 +128,6 @@ void cmWIXSourceWriter::AddAttributeUnlessEmpty(std::string const& key, } } -std::string cmWIXSourceWriter::CMakeEncodingToUtf8(std::string const& value) -{ -#ifdef CMAKE_ENCODING_UTF8 - return value; -#else - if (value.empty()) { - return std::string(); - } - - int characterCount = MultiByteToWideChar( - CP_ACP, 0, value.c_str(), static_cast<int>(value.size()), 0, 0); - - if (characterCount == 0) { - return std::string(); - } - - std::vector<wchar_t> utf16(characterCount); - - MultiByteToWideChar(CP_ACP, 0, value.c_str(), static_cast<int>(value.size()), - &utf16[0], static_cast<int>(utf16.size())); - - int utf8ByteCount = WideCharToMultiByte( - CP_UTF8, 0, &utf16[0], static_cast<int>(utf16.size()), 0, 0, 0, 0); - - if (utf8ByteCount == 0) { - return std::string(); - } - - std::vector<char> utf8(utf8ByteCount); - - WideCharToMultiByte(CP_UTF8, 0, &utf16[0], static_cast<int>(utf16.size()), - &utf8[0], static_cast<int>(utf8.size()), 0, 0); - - return std::string(&utf8[0], utf8.size()); -#endif -} - std::string cmWIXSourceWriter::CreateGuidFromComponentId( std::string const& componentId) { |