From 076aef8e45a91e83f9a7d879712fd70778d67c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C4=81vis=20Mos=C4=81ns?= Date: Mon, 14 Nov 2016 04:05:08 +0200 Subject: Windows: Use UTF-8 for pipes in CMake, CTest and CPack Applications which process CMake output will need to decode it as UTF-8 instead of console's codepage. --- Source/CPack/cpack.cxx | 2 ++ Source/CTest/cmProcess.cxx | 2 +- Source/cmakemain.cxx | 2 ++ Source/ctest.cxx | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index fa526ae..af80cbf 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -91,7 +91,9 @@ int main(int argc, char const* const* argv) #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) // Replace streambuf so we can output Unicode to console cmsys::ConsoleBuf::Manager consoleOut(std::cout); + consoleOut.SetUTF8Pipes(); cmsys::ConsoleBuf::Manager consoleErr(std::cerr, true); + consoleErr.SetUTF8Pipes(); #endif cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 98bd3bb..32ffa6b 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -105,7 +105,7 @@ bool cmProcess::Buffer::GetLast(std::string& line) int cmProcess::GetNextOutputLine(std::string& line, double timeout) { - cmProcessOutput processOutput; + cmProcessOutput processOutput(cmProcessOutput::UTF8); std::string strdata; for (;;) { // Look for lines already buffered. diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index dee288c..b8e227f 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -160,7 +160,9 @@ int main(int ac, char const* const* av) #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) // Replace streambuf so we can output Unicode to console cmsys::ConsoleBuf::Manager consoleOut(std::cout); + consoleOut.SetUTF8Pipes(); cmsys::ConsoleBuf::Manager consoleErr(std::cerr, true); + consoleErr.SetUTF8Pipes(); #endif cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(ac, av); diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 1acd240..1cf75c8 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -116,7 +116,9 @@ int main(int argc, char const* const* argv) #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) // Replace streambuf so we can output Unicode to console cmsys::ConsoleBuf::Manager consoleOut(std::cout); + consoleOut.SetUTF8Pipes(); cmsys::ConsoleBuf::Manager consoleErr(std::cerr, true); + consoleErr.SetUTF8Pipes(); #endif cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); -- cgit v0.12