summaryrefslogtreecommitdiff
path: root/indra/newview/lllogchat.cpp
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2020-04-27 19:10:31 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2020-04-27 19:10:31 +0300
commitac2611b380a8ff5f8d2e9bc1ad84a11954b76a73 (patch)
treeaaa311f130d9d6b55bfb4f108d926f0178a11494 /indra/newview/lllogchat.cpp
parent94dc8f12f86adb3bf79b44ab0bc98e6c0f6899ee (diff)
SL-13018 FIXED Chat Transcripts not showing on right click when encoding of text file is UTF-8 with BOM
Diffstat (limited to 'indra/newview/lllogchat.cpp')
-rw-r--r--indra/newview/lllogchat.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 0c64531783..a623693a62 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -133,6 +133,16 @@ void append_to_last_message(std::list<LLSD>& messages, const std::string& line)
messages.back()[LL_IM_TEXT] = im_text;
}
+std::string remove_utf8_bom(const char* buf)
+{
+ std::string res(buf);
+ if (res[0] == (char)0xEF && res[1] == (char)0xBB && res[2] == (char)0xBF)
+ {
+ res.erase(0, 3);
+ }
+ return res;
+}
+
class LLLogChatTimeScanner: public LLSingleton<LLLogChatTimeScanner>
{
LLSINGLETON(LLLogChatTimeScanner);
@@ -417,7 +427,7 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m
continue;
}
- std::string line(buffer);
+ std::string line(remove_utf8_bom(buffer));
//updated 1.23 plain text log format requires a space added before subsequent lines in a multilined message
if (' ' == line[0])
@@ -805,7 +815,7 @@ bool LLLogChat::isTranscriptFileFound(std::string fullname)
{
//matching a timestamp
boost::match_results<std::string::const_iterator> matches;
- if (boost::regex_match(std::string(buffer), matches, TIMESTAMP))
+ if (boost::regex_match(remove_utf8_bom(buffer), matches, TIMESTAMP))
{
result = true;
}
@@ -1126,7 +1136,7 @@ void LLLoadHistoryThread::loadHistory(const std::string& file_name, std::list<LL
firstline = FALSE;
continue;
}
- std::string line(buffer);
+ std::string line(remove_utf8_bom(buffer));
//updated 1.23 plaint text log format requires a space added before subsequent lines in a multilined message
if (' ' == line[0])