mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 05:59:28 +02:00
IDE: try to convert exception message from debugger to UTF8, if it contains invalid UTF8 chars (issue #13096)
git-svn-id: trunk@18534 -
This commit is contained in:
parent
e8466521ad
commit
a9eb4a743b
@ -1241,7 +1241,9 @@ end;
|
||||
|
||||
procedure TDebugManager.DebuggerException(Sender: TObject; const AExceptionClass, AExceptionText: String);
|
||||
var
|
||||
ExceptMsg: string;
|
||||
msg: String;
|
||||
|
||||
begin
|
||||
if Destroying then exit;
|
||||
|
||||
@ -1249,9 +1251,15 @@ begin
|
||||
then
|
||||
msg := Format('Project %s raised exception class ''%s''.',
|
||||
[Project1.Title, AExceptionClass])
|
||||
else
|
||||
else begin
|
||||
ExceptMsg := AExceptionText;
|
||||
// if AExceptionText is not a valid UTF8 string,
|
||||
// then assume it has the ansi encoding and convert it
|
||||
if FindInvalidUTF8Character(pchar(ExceptMsg),length(ExceptMsg), False) > 0 then
|
||||
ExceptMsg := AnsiToUtf8(ExceptMsg);
|
||||
msg := Format('Project %s raised exception class ''%s'' with message:%s%s',
|
||||
[Project1.Title, AExceptionClass, #13, AExceptionText]);
|
||||
[Project1.Title, AExceptionClass, #13, ExceptMsg]);
|
||||
end;
|
||||
|
||||
MessageDlg('Error', msg, mtError,[mbOk],0);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user