cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From daserge <...@git.apache.org>
Subject [GitHub] cordova-plugin-file-transfer pull request: uploadResponse encoding...
Date Thu, 22 Oct 2015 16:17:25 GMT
Github user daserge commented on the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/71#issuecomment-150277783
  
    The endpoint for this test on the file-transfer server can be the following (requires
[`node-iconv`](https://github.com/bnoordhuis/node-iconv) dependency):
    ```javascript
    if (req.url == '/upload_non_utf' && req.method.toLowerCase() == 'post') {
            var form = new formidable.IncomingForm();
            form.parse(req, function(err, fields, files) {
                res.writeHead(200, {'content-type': 'text/plain'});
                console.log(stringify({fields: fields, files: files}));
    
                // convert from UTF-8 to ISO-8859-1
                var Iconv  = require('iconv').Iconv;
    
                var iconv = new Iconv('UTF-8', 'ISO-8859-1');
                var buffer = iconv.convert(stringify({fields: fields, files: files, latin1Symbols:
'¥§©ÆÖÑøøø¼'}));
                res.write(buffer);
    
                console.log
                res.end("\n");
            });
        }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message