Paul Poirel created CB-1701: ------------------------------- Summary: FileTransfer response UTF-8 Bug Key: CB-1701 URL: https://issues.apache.org/jira/browse/CB-1701 Project: Apache Cordova Issue Type: Bug Components: Android Affects Versions: 2.1.0 Environment: Android, Eclipse Reporter: Paul Poirel Assignee: Joe Bowser Priority: Minor
I am using the FileTransfer API to upload a picture to a .ashx service (.NET). Everything is fine, except that the response (FileUploadResult.response) is not correctly encoded. It appears like a UTF8 string encoded as ISO. Here are the logs from Eclipse debug console (LogCat) : 10-23 00:21:39.580: D/FileTransfer(24513): upload file:///mnt/sdcard/AgoraStockPictures/740aze1350954367223.jpg to http://*************************/upload-photo.ashx 10-23 00:21:39.580: D/FileTransfer(24513): fileKey: fileData 10-23 00:21:39.580: D/FileTransfer(24513): fileName: 740aze1350954367223.jpg 10-23 00:21:39.580: D/FileTransfer(24513): mimeType: image/jpeg 10-23 00:21:39.580: D/FileTransfer(24513): params: {"lastPicture":true,"idproduit":"teststock2224388212","token":"9876543","login":"teststock"} 10-23 00:21:39.580: D/FileTransfer(24513): trustEveryone: false 10-23 00:21:39.580: D/FileTransfer(24513): chunkedMode: true 10-23 00:21:39.580: D/FileTransfer(24513): headers: null 10-23 00:21:39.580: D/FileTransfer(24513): String Length: 424 10-23 00:21:39.580: D/FileTransfer(24513): Content Length: 91341 10-23 00:21:40.910: D/FileTransfer(24513): got response from server 10-23 00:21:40.910: D/FileTransfer(24513): [{"data":{},"errors":{"etat":"-93","libelle":"L\u0027image existe déjà ."}}] 10-23 00:21:40.910: D/FileTransfer(24513): ****** About to return a result from upload And the result (in an alert or in console.log) is : {"etat":"-93","libelle":"L'image existe déjà ."} The expected result is : {"etat":"-93","libelle":"L'image existe déjà ."} When I test the server whith a html form on chrome, I get the correct result. Plus, the result looks like UTF8 displayed as ISO, so I believe that the server is sending the UTF8 encoded response, and that it is a client-side issue. Here are the HTTP headers from the response : HTTP/1.1 200 OK Cache-Control: private Content-Length: 197 Content-Type: text/plain; charset=UTF-8 Content-Encoding: gzip Server: Microsoft-IIS/7.5 X-AspNet-Version: 2.0.50727 Accepts-Encoding: gzip Access-Control-Allow-Origin: * X-Powered-By: ASP.NET Date: Tue, 23 Oct 2012 10:28:33 GMT Note : this might be related to the issue #CB-920, which was about the POST params encoding. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira