我正在使用 TRESTRequest 从服务器获取数据。我需要用 Unicode 字符串值填充参数:"ôpen"。但是,使用此 Unicode 字符串作为查询参数调用 Execute 时出现崩溃。
我的代码:
RESTRequest->ResetToDefaults();
RESTRequest->AddParameter("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8 ", TRESTRequestParameterKind::pkHTTPHEADER);
// Get Indexing Status
RESTRequest->Resource = "XXX/collection1"+ Form1->teReuqestHandler->Text+"?";
RESTRequest->Method = rmGET;
// replace all space in name field with '\ '
UnicodeString lcQuery = Form1->teQuery->Text; // this value should be support french language or ...
// Body
RESTRequest->AddParameter("q",lcQuery, TRESTRequestParameterKind::pkGETorPOST);
// Run
String str1 = RESTRequest->GetFullRequestURL();
RESTRequest->Execute(); // here when pass "ôpen" to lcQuery, it crash
如何正确地将“ôpen”添加到我的 URL?