Jump to content

Search the Community

Showing results for tags 'utf8'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. I save a JSON file on Dropbox, after reading it I don't get it in the correct UTF-8 state as it left, please advise. I am sending Czech characters {"auth":{"text1":"cz_čřšť","text2":"ýáíé","int":10}} I will get {"auth":{"text1":"cz_èø","text2":"ýáíé","int":10}} POST code procedure TForm2.btn_Upload_JsonClick(Sender: TObject); const API_URL = 'https://content.dropboxapi.com/2/files/upload'; var IdHTTP: TIdHTTP; Res : string; Ssl: TIdSSLIOHandlerSocketOpenSSL; Json : string; Req_Json:TStringStream; begin Json := '{"auth":{"text1":"cz_čřšť","text2":"ýáíé","int":10}}'; Req_Json:=TstringStream.Create(Json); Req_Json.Position:=0; IdHTTP := TIdHTTP.Create(nil); try Memo1.Lines.Clear; IdHTTP.HandleRedirects := True; ssl := TIdSSLIOHandlerSocketOpenSSL.Create(); ssl.SSLOptions.Method := sslvTLSv1_2; ssl.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; ssl.SSLOptions.Mode := TidSSLMode.sslmUnassigned; ssl.SSLOptions.VerifyMode := []; ssl.SSLOptions.VerifyDepth := 0; ssl.host := ''; IdHTTP.IOHandler := ssl; IdHTTP.Request.CustomHeaders.Values['Authorization'] := 'Bearer ' + myAccessToken; IdHTTP.Request.CustomHeaders.Values['Dropbox-API-Arg'] := '{ "autorename": false, "mode": "add", "mute": false, "path": "/CUZK/test3.json", "strict_conflict": false }'; IdHTTP.Request.CustomHeaders.Values['Content-Type'] := 'application/octet-stream'; IdHTTP.Request.CharSet:='utf-8'; Memo1.Lines.Add('** IdHTTP.Request.CustomHeaders.Text **'); Memo1.Lines.Add(IdHTTP.Request.CustomHeaders.Text); Memo1.Lines.Add('** ssl.OnStatusInfoEx **'); ssl.OnStatusInfoEx := IdSSLIOHandlerSocketOpenSSL1StatusInfoEx; (**) Res := IdHTTP.Post(API_URL, Req_Json); memo1.Lines.Add('------------------------------------'); Memo1.Lines.Add(Res); finally IdHTTP.Free; Req_Json.Free; end; GET CODE procedure TForm2.btn_Download_File_Click(Sender: TObject); const API_URL = 'https://content.dropboxapi.com/2/files/download'; var Source: TMemoryStream; IdHTTP: TIdHTTP; Res : string; Ssl: TIdSSLIOHandlerSocketOpenSSL; begin IdHTTP := TIdHTTP.Create(nil); try IdHTTP.HandleRedirects := True; ssl := TIdSSLIOHandlerSocketOpenSSL.Create(); ssl.SSLOptions.Method := sslvTLSv1_2; Ssl.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; ssl.SSLOptions.Mode := TidSSLMode.sslmUnassigned; ssl.SSLOptions.VerifyMode := []; ssl.SSLOptions.VerifyDepth := 0; ssl.host := ''; Source := TMemoryStream.Create; IdHTTP.IOHandler := ssl; IdHTTP.Request.CustomHeaders.Values['Authorization'] := 'Bearer ' + myAccessToken; IdHTTP.Request.CustomHeaders.Values['Dropbox-API-Arg'] := '{ "path": "/CUZK/test3.json" }'; IdHTTP.Request.CharSet := 'utf-8'; Res := ansitoutf8(IdHTTP.Get(API_URL)); memo1.Lines.Add('------------------------------------'); Memo1.Lines.Add(Res); finally IdHTTP.Free; Source.Free; end; end;
×