diff options
author | Amine Najahi <anajahi@mathworks.com> | 2021-04-22 19:26:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-05-05 14:56:49 (GMT) |
commit | f3f57cc4edd528aaf0b8d8633d5f9990f0d804af (patch) | |
tree | 3ca9148977b9d0044fc5524e9fd3c1f93adeecad /Source/cmGeneratedFileStream.cxx | |
parent | 186c9bff5342c1e8e73fce9cf361b6de5dda3f28 (diff) | |
download | CMake-f3f57cc4edd528aaf0b8d8633d5f9990f0d804af.zip CMake-f3f57cc4edd528aaf0b8d8633d5f9990f0d804af.tar.gz CMake-f3f57cc4edd528aaf0b8d8633d5f9990f0d804af.tar.bz2 |
NMake: Use UTF-8 with BOM if supported by nmake
Fixes: #21792
Diffstat (limited to 'Source/cmGeneratedFileStream.cxx')
-rw-r--r-- | Source/cmGeneratedFileStream.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 43f384a..06778b1 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -42,6 +42,11 @@ cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name, #else static_cast<void>(encoding); #endif + if (encoding == codecvt::UTF8_WITH_BOM) { + // Write the BOM encoding header into the file + char magic[] = { char(0xEF), char(0xBB), char(0xBF) }; + this->write(magic, 3); + } } cmGeneratedFileStream::~cmGeneratedFileStream() |