Skip to content

Commit bd7ae53

Browse files
committed
Fix UTF-8 encoding in async process output and add debug marker
The AsyncProcess reader thread was using wxString stream operators to convert raw byte content, which does not properly handle UTF-8 encoded data. This has been replaced with explicit UTF-8 decoding via wxString::FromUTF8() for both stdout and stderr output streams. Additionally, a debug marker "[**STDOUT**]" has been prepended to the LSP trace output in LSPNetworkSTDIO to improve log readability and make stdout events easier to identify in debug traces. * AsyncProcess: UTF-8 encoding * LSP: debug tracing **Generated by CodeLite** Signed-off-by: Eran Ifrah <eran@codelite.org>
1 parent e428f61 commit bd7ae53

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CodeLite/AsyncProcess/UnixProcess.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void UnixProcess::StartReaderThread()
206206
break;
207207
} else if (!content.empty()) {
208208
clProcessEvent evt(wxEVT_ASYNC_PROCESS_OUTPUT);
209-
evt.SetOutput(wxString() << content);
209+
evt.SetOutput(wxString::FromUTF8(content));
210210
evt.SetOutputRaw(content);
211211
process->m_owner->AddPendingEvent(evt);
212212
}
@@ -217,7 +217,7 @@ void UnixProcess::StartReaderThread()
217217
break;
218218
} else if (!content.empty()) {
219219
clProcessEvent evt(wxEVT_ASYNC_PROCESS_STDERR);
220-
evt.SetOutput(wxString() << content);
220+
evt.SetOutput(wxString::FromUTF8(content));
221221
evt.SetOutputRaw(content);
222222
process->m_owner->AddPendingEvent(evt);
223223
}

Plugin/LSP/LSPNetworkSTDIO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void LSPNetworkSTDIO::OnProcessOutput(clProcessEvent& event)
5353
evt.SetString(dataRead);
5454
evt.SetStringRaw(dataReadRaw);
5555

56-
LSP_TRACE() << dataRead << endl;
56+
LSP_TRACE() << "[**STDOUT**]" << dataRead << endl;
5757
AddPendingEvent(evt);
5858
}
5959

0 commit comments

Comments
 (0)