开发者

delphi 2010- Send unicode string to web by idhttp.get

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开发者_JS百科 := f2.DataString;
end;

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

what is the problem?

thanks.


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜