From b96c41df075d90ea3aba940ebe6bd297925d39ac Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 16 Feb 2022 17:08:39 +0100 Subject: [PATCH] Initialize string_view with explicit size Otherwise size is detected by null terminating character. --- components/to_utf8/to_utf8.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/to_utf8/to_utf8.cpp b/components/to_utf8/to_utf8.cpp index f4b52b644b..7e7d3101fc 100644 --- a/components/to_utf8/to_utf8.cpp +++ b/components/to_utf8/to_utf8.cpp @@ -57,13 +57,13 @@ namespace switch (sourceEncoding) { case ToUTF8::WINDOWS_1252: - return ToUTF8::windows_1252; + return {ToUTF8::windows_1252, std::size(ToUTF8::windows_1252)}; case ToUTF8::WINDOWS_1250: - return ToUTF8::windows_1250; + return {ToUTF8::windows_1250, std::size(ToUTF8::windows_1250)}; case ToUTF8::WINDOWS_1251: - return ToUTF8::windows_1251; + return {ToUTF8::windows_1251, std::size(ToUTF8::windows_1251)}; case ToUTF8::CP437: - return ToUTF8::cp437; + return {ToUTF8::cp437, std::size(ToUTF8::cp437)}; } throw std::logic_error("Invalid source encoding: " + std::to_string(sourceEncoding)); }