You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Paul Poirel (JIRA)" <ji...@apache.org> on 2012/10/24 09:08:12 UTC

[jira] [Created] (CB-1701) FileTransfer response UTF-8 Bug

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

[jira] [Commented] (CB-1701) FileTransfer response UTF-8 Bug

Posted by "Paul Poirel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13483939#comment-13483939 ] 

Paul Poirel commented on CB-1701:
---------------------------------

Yes, I have tested the web service outside of Cordova, with a HTML form in Google Chrome.
Furthermore, in the PhoneGap App, I am calling other methods of the web service with AJAX without this problem.
Plus, it looks like an UTF8 string encoded as ANSI. If the server were sending an ANSI string and if PhoneGap parsed it as UTF8, I wouldn't see two characters by expected character, but squares (for invalid characters).

I will test from the 2.2.0rc1 tag, but I have no time now (I am supposed to deliver the app by the end of the week).
                
> 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: Andrew Grieve
>            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

[jira] [Assigned] (CB-1701) FileTransfer response UTF-8 Bug

Posted by "Andrew Grieve (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-1701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Grieve reassigned CB-1701:
---------------------------------

    Assignee: Andrew Grieve  (was: Joe Bowser)
    
> 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: Andrew Grieve
>            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

[jira] [Commented] (CB-1701) FileTransfer response UTF-8 Bug

Posted by "Andrew Grieve (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13483219#comment-13483219 ] 

Andrew Grieve commented on CB-1701:
-----------------------------------

Paul, Thanks for the report, and thanks for all of the details you included. Looking at the code, I think that there is a very good chance that this has actually already been fixed by a refactoring that has happened since 2.1.0.

Could you test it either at head, or from the 2.2.0rc1 tag?
                
> 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: Andrew Grieve
>            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