I’m posting the reply that you put on Stackoverflow.com so that your question is not orphaned and I can help other people.
I found the solution, I made a class that convert Unicode to
UTF8
function TForm1.DecodeUnicodeEscapes(EscapedString: String): String;
var
FoundPos: LongInt;
HexCode: String;
DecodedChars: String;
begin
Result := EscapedString;
FoundPos := Pos('\u', Result);
while (FoundPos <> 0) and (FoundPos < Length(Result) - 4) do begin
HexCode := Copy(Result, FoundPos + 2, 4);
DecodedChars := WideChar(StrToInt('$' + HexCode));
Result := AnsiReplaceStr(Result, '\u' + HexCode,
UTF8Encode(DecodedChars));
FoundPos := Pos('\u', Result);
end;
end;
Applying the class:
procedure TForm1.Button1Click(Sender: TObject);
var
s: String;
begin
s := '';
With TFPHttpClient.Create(Nil) do
try
s :=Get(Edit1.Text);
s := DecodeUnicodeEscapes(s);
finally
Free;
end;
Memo1.Lines.Text:=Trim(s);
end;
Thanks man, I should have done this kk, sorry
– Gabriel Santos