LazUtils/LazStringUtils.SpecialCharsToHex writed the wrong format
Original Reporter info from Mantis: dsiders @dsiders
-
Reporter name: Don Siders
Original Reporter info from Mantis: dsiders @dsiders
- Reporter name: Don Siders
Description:
In unit components/lazutils/LazStringUtils.pas:
SpecialCharsToHex does not use the correct format for the converted character constants. It uses %d in its Format argument instead of %x, and writes the constant using #ddd notation instead of #$xx.
The routine is misnamed for the current implementation, or the implementation is incorrect.
Steps to reproduce:
procedure TForm1.Button1Click(Sender: TObject);
var
AString: AnsiString;
i: Integer;
begin
AString := '';
for i := 0 to 64 do
AString := AString + Chr(i);
AString := SpecialCharsToHex(AString);
Memo1.Lines.Text := AString;
end;
Produces:
#0#1 (closed)#2 (closed)#3 (closed)#4 (closed)#5 (closed)#6 (closed)#7 (closed)#8 (closed)#9 (closed)#10 (closed)#11 (closed)#12 (closed)#13 (closed)#14 (closed)#15 (closed)#16 (closed)#17 (closed)#18 (closed)#19 (closed)#20 (closed)#21 (closed)#22 (closed)#23 (closed)#24 (closed)#25 (closed)#26 (closed)#27 (closed)#28 (closed)#29 (closed)#30 (closed)#31 (closed) !"#$%&'() ...
Mantis conversion info:
- Mantis ID: 38029
- OS: Windows
- OS Build: 8.1
- Build: 64101
- Platform: Win64
- Version: 2.1 (SVN)
- Fixed in revision: r64102 (#5d899688), r64103 (#039687aa)
- Monitored by: » @flyingsheep (Bart Broersma)