Suppose for some vicious reason you want to display the contents of the original byte of UTF8String.
var
utf8Str : UTF8String;
begin
utf8Str := '€ąćęłńóśźż';
end;
(1) This does not happen; it displays a readable form:
memo1.Lines.Add( RawByteString( utf8Str ));
// output: '€ąćęłńóśźż'
(2) This, however, "works" - note the concatenation:
memo1.Lines.Add( 'x' + RawByteString( utf8Str ));
// output: 'x€ąćęłńóśźż'
I understand (1), although forcing the compiler to UnicodeString does not seem to allow RawByteString var as-is to be displayed. However, why the behavior change in (2)?
(3) Stranger - cancel concatenation:
memo1.Lines.Add( RawByteString( utf8Str ) + 'x' );
// output: '€ąćęłńóśźżx'
I read new line types in Delphi and thought I understood how they work, but this is a mystery.
source
share