diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-10-05 18:07:29 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-10-05 18:07:29 -0700 |
| commit | 9b0c2cb2524ef3fa1e8e7e8f2512c32e40eb5815 (patch) | |
| tree | 1f7959bd4d52c1bac277d85568c1c0aee523a38f | |
| parent | 74bab196c9e3022c48667e83c1003acf9cc7eebc (diff) | |
| download | vcpkg-9b0c2cb2524ef3fa1e8e7e8f2512c32e40eb5815.tar.gz vcpkg-9b0c2cb2524ef3fa1e8e7e8f2512c32e40eb5815.zip | |
[vcpkg] Remove multiple byte order marks
| -rw-r--r-- | toolsrc/src/vcpkg_System.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 7a6e7f028..3b4c440d8 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -177,12 +177,11 @@ namespace vcpkg::System } // On Win7, output from powershell calls contain a byte order mark, so we strip it out if it is present - static void remove_byte_order_mark(std::wstring* s) + static void remove_byte_order_marks(std::wstring* s) { - if (s->size() < 3) return; const wchar_t* a = s->c_str(); // This is the UTF-8 byte-order mark - if (a[0] == 0xEF && a[1] == 0xBB && a[2] == 0xBF) + while (s->size() >= 3 && a[0] == 0xEF && a[1] == 0xBB && a[2] == 0xBF) { s->erase(0, 3); } @@ -214,7 +213,7 @@ namespace vcpkg::System const auto ec = _pclose(pipe); Debug::println("_pclose() returned %d", ec); - remove_byte_order_mark(&output); + remove_byte_order_marks(&output); return {ec, Strings::to_utf8(output)}; } |
