Ich habe ein Problem mit HTTPBuilder in Grails.HTTPBuilder kodierend UTF-8 in Grails
Der Code ist so etwas.
def http = new HTTPBuilder("theURL")
http.request(method, ContentType.JSON) {
uri.path = "theURI"
headers.'Authorization' = "OAuth $accessToken"
headers.'Accept' = "application/json"
headers.'content-type' = "application/json;charset=utf-8"
response.success = { resp, json ->
result = json
}
}
return result
Jetzt ist die Antwort ein JSON mit "Cobro N 1234", aber ich brauche "Cobro Nº 1234"
Ich habe versucht, dies mit curl und die Antwort ist in Ordnung "Cobro Nº 1234", das ließ mich denken, dass das Problem der HTTPBuilder und nicht meine API ist, wer die Anfrage beantwortet.
Ich denke, dass es ein Problem mit der Antwort-Codierung ist.
Der Endpunkt ist Sie treffen? – Opal
Ist eine API in Salesforce mit Authentifizierung (aber ich lösche diesen Teil des Codes im Snippet) – dimartiro
Haben Sie versucht, 'content-type 'als' application/json; charset = utf-8' zu setzen? – dmahapatro