You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/11/24 11:23:58 UTC

[cordova-labs] 01/01: update dependencies an replace iconv with iconv-lite (for Windows support)

This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-filetransfer_update_deps
in repository https://gitbox.apache.org/repos/asf/cordova-labs.git

commit 12efb74d008f2ab41d5b67e09867c643cb5e59ca
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Sat Nov 24 12:23:47 2018 +0100

    update dependencies an replace iconv with iconv-lite (for Windows support)
---
 package.json |  6 +++---
 server.js    | 10 ++++------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/package.json b/package.json
index 208c55e..4b62d30 100644
--- a/package.json
+++ b/package.json
@@ -9,8 +9,8 @@
     "node": ">=0.10.0"
   },
   "dependencies": {
-    "busboy": "0.2.12",
-    "iconv": "2.2.0",
-    "json-stringify-safe": "5.0.0"
+    "busboy": "0.2.14",
+    "iconv-lite": "^0.4.24",
+    "json-stringify-safe": "5.0.1"
   }
 }
diff --git a/server.js b/server.js
index edf0428..c696c6d 100644
--- a/server.js
+++ b/server.js
@@ -1,16 +1,14 @@
 var http = require('http'),
     util = require('util'),
     port = process.env.PORT || 5000;
-    stringify = require('json-stringify-safe'),
+    stringify = require('json-stringify-safe'), 
     Busboy = require('busboy'),
     inspect = require('util').inspect;
 
 var DIRECT_UPLOAD_LIMIT = 85; // bytes
 
-// convert from UTF-8 to ISO-8859-1
 var LATIN1_SYMBOLS = '¥§©ÆÖÑøøø¼';
-var Iconv  = require('iconv').Iconv;
-var iconv = new Iconv('UTF-8', 'ISO-8859-1');
+var iconv  = require('iconv-lite');
 
 function parseMultipartForm(req, res, finishCb) {
     var fields = {}, files = {};
@@ -61,7 +59,7 @@ function respondWithParsedForm(req, res, parseResultObj) {
 
 function respondWithParsedFormNonUTF(req, res, parseResultObj) {
     parseResultObj["latin1Symbols"] = LATIN1_SYMBOLS;
-    var buffer = iconv.convert(stringify(parseResultObj));
+    var buffer = iconv.encode(stringify(parseResultObj), 'ISO-8859-1');
     res.writeHead(200, {'Content-Type': 'application/json'});
     res.write(buffer);
     res.end("\n");
@@ -98,7 +96,7 @@ http.createServer(function (req, res) {
         res.writeHead(200, {'Content-Type': 'text/plain'});
         res.write("User-Agent: *\n");
 
-        res.write(iconv.convert(LATIN1_SYMBOLS));
+        res.write(iconv.encode(LATIN1_SYMBOLS), 'ISO-8859-1');
 
         res.end("Disallow: /\n");
     } else if (req.url === "/") {


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