|
@@ -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)
|
|
|
{
|