From f103c825a0914fbb461752ecf85c3cbc37a2e915 Mon Sep 17 00:00:00 2001 From: Michael Zhao <44533763+Pistonight@users.noreply.github.com> Date: Sun, 21 Jun 2026 00:06:14 -0700 Subject: [PATCH] fix: Buffer.cpp ToUTF8String should accept string without BOM --- src/SexyAppFramework/Buffer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/SexyAppFramework/Buffer.cpp b/src/SexyAppFramework/Buffer.cpp index 6460035a..d8e7a941 100644 --- a/src/SexyAppFramework/Buffer.cpp +++ b/src/SexyAppFramework/Buffer.cpp @@ -8,7 +8,7 @@ static unsigned long crc_table[256]; using namespace Sexy; -static char *gWebEncodeMap = ".-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +static const char *gWebEncodeMap = ".-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; static int gWebDecodeMap[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -205,17 +205,15 @@ bool Buffer::ToUTF8String(std::string *theString) const { // UTF-8 BOM: strip it *theString = std::string(aData + 3, aLen - 3); - return true; } else { // no BOM: just copy as-is *theString = std::string(aData, aLen); } - - return false; -} + return true; +} void Buffer::FromWebString(const std::string &theString) {