0

i write the following code to send Unicode string to web server

procedure TForm1.Button1Click(Sender: TObject);
var
  f2 : TStringStream;
  str1, str2 : string;
  str3 : WideString;
begin
  f2 := TStringStream.Create('');
  str1 := ('مهر');//Persian character (Unicode);
  str2 := ('آذر');//Persian character (Unicode);
  str3 := str2;
  IdHTTP1.Get('http://mehratin.heroku.com/personals/add_item?fn=' + str1 + '&ln=' + str3, f2);
  Caption := f2.DataString;
end;

data is saved but it shows '?' . you can see data: http://mehratin.heroku.com/personals

what is the problem?

thanks.

RRUZ
  • 134,889
  • 20
  • 356
  • 483
Abolfazl Mahmoodi
  • 380
  • 1
  • 3
  • 20

1 Answers1

0

You need to encode your unicode strings into the URL properly.

By design, URL strings are ANSI (which is why you don't get Higurana/Cyrilic etc. domain names).

I suggest you take a look at this StackOverflow question and its answer about URL-encoding UTF8 (unicode) strings.

Best of luck!

Community
  • 1
  • 1
LaKraven
  • 5,804
  • 2
  • 23
  • 49