From 307a0916fd7581870d40b920d776dec7ff60e8e7 Mon Sep 17 00:00:00 2001 From: Pavel Tyunin Date: Mon, 5 Oct 2020 15:29:11 +0300 Subject: [PATCH] Add comment about 2 extra bytes in wxConvAuto::ToWChar --- src/common/convauto.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/convauto.cpp b/src/common/convauto.cpp index d5d6079b32..f63d015c83 100644 --- a/src/common/convauto.cpp +++ b/src/common/convauto.cpp @@ -313,6 +313,8 @@ wxConvAuto::ToWChar(wchar_t *dst, size_t dstLen, // to the fall-back conversion in this case as it would prevent us from // decoding UTF-8 input when fed it byte by byte, as done by // wxTextInputStream, for example + // 2 extra bytes are needed for inputs that start with 1 or 2 null bytes + // that look like the start of UTF-32BE BOM, but can be in UTF-8 too if ( srcLen < 2 + m_conv->GetMaxCharLen() && wxIsUTF8Prefix(src, srcLen) ) return wxCONV_FAILED;