You are not logged in.
Pages: 1
When using SynCommons.Trim() on a (string) variant and placing the result in another (string) variant, we lose all accented characters. No problem when using SysUtils.Trim.
Uses SynCommons;
procedure TForm2.Button1Click(Sender: TObject);
var st : String;
v,v2 : Variant;
begin
v:='sérieux ';
v2:=Trim(v);
st:=v2;
showmessage(v+' => '+st); // st contains "srieux"
end;
Using mORMot framework 1.18 (today's nightly build) on Delphi 2010
Offline
No, this is more likely a compiler bug.
The compiler is not clever enough to efficiently convert a variant into a RawUTF8 variable.
If you try
v2 := UTF8ToString(Trim(VariantToUTF8(v)));
that is, if you avoid hidden comparison made by the compiler, it should be fine.
BTW, did you notice the compiler warnings/hints in your source code?
Do not let them happen.
Offline
Pages: 1