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!
精彩评论