0

在Worklight中,我试图发送一个包含希腊字母参数的HTTP请求(通过HTTP适配器)。然而,应用的编码将希腊字母改为象形文字。有谁知道我可以如何让请求发送希腊字符?Worklight - 通过HTTP发送希腊字符

var request = 
    '<?xml version="1.0" encoding="UTF-8"?>' 
    + '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ' 
    + 'xmlns:test="">' 
    + '<soapenv:Header/>' 
    +  '<soapenv:Body>' 
    +   '<test:getAnalysis>' 
    +    '<request>' 
    +     '<invoiceId>' + invoiceId + '</invoiceId>' 
    +    '</request>' 
    +   '</test:getAnalysis>' 
    +  '</soapenv:Body>' 
    + '</soapenv:Envelope>'; 

    var options = { 
     method : 'post', 
     returnedContentType : 'xml', 
     path : getPath(), 
     body: { 
      content: request.toString(), 
      contentType: 'text/xml; charset=utf-8', 
     }, 
    }; 
return WL.Server.invokeHttp(options).Envelope.Body; 
+1

你使用什么编码?你怎么应用它? – Floris

+1

你可以包含你的代码样本吗? –

+1

我刚刚尝试使HTTP适配器将希腊数据发送到测试服务器,并且它工作正常。你也可以试试。发送带有名为'data'的参数的POST到这个URL:http://burnished-yeti-689.appspot.com/ –

回答

0

上述请求正常工作。 UTF-8是唯一需要的东西。当我尝试通过eclipse调用适配器时出现编码问题。当通过应用程序调用适配器时,使用正确的编码发送参数。