mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 18:58:04 +02:00
Converter: Do not convert ansi control characters to unicode. Issue #26274, patch from Jesus Reyes.
git-svn-id: trunk@45417 -
This commit is contained in:
parent
68d119347e
commit
ae302f31b2
@ -211,6 +211,29 @@ function TDFMConverter.FixWideString(aInStream, aOutStream: TMemoryStream): TMod
|
||||
Result:=SysToUTF8(chr(c));
|
||||
end;
|
||||
|
||||
function FixControlChars(const s:string): string;
|
||||
var
|
||||
i: Integer;
|
||||
InControl: boolean;
|
||||
begin
|
||||
Result := '';
|
||||
InControl := false;
|
||||
for i:=1 to Length(s) do begin
|
||||
if s[i] < #32 then begin
|
||||
if not InControl then
|
||||
result := result + '''';
|
||||
result := result + '#' + IntToStr(ord(s[i]));
|
||||
InControl := true;
|
||||
end else begin
|
||||
if InControl then begin
|
||||
result := result + '''';
|
||||
InControl := false;
|
||||
end;
|
||||
Result := Result + s[i];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function CollectString(const InS: string; var Ind: integer): string;
|
||||
// Collect a string composed of quoted strings and unicode numbers like #xxx
|
||||
var
|
||||
@ -235,7 +258,7 @@ function TDFMConverter.FixWideString(aInStream, aOutStream: TMemoryStream): TMod
|
||||
else
|
||||
Break;
|
||||
until False;
|
||||
Result:=QuotedStr(Result);
|
||||
Result:=FixControlChars(QuotedStr(Result));
|
||||
end;
|
||||
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user