aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2017-05-06 12:57:16 +0200
committerNoah Loomans <noahloomans@gmail.com>2017-05-06 12:57:16 +0200
commit27b4e7b47acbd1fa212db7f11b7b3b310193c009 (patch)
treee35ecefdab9be247c528414ba5bd4b0cd64dc063
parent0b618a099c9a9d3fcef3daf26d78421fbc3a07b6 (diff)
Unicode.
-rw-r--r--package.json1
-rw-r--r--routes/meetingpointProxy.js12
2 files changed, 8 insertions, 5 deletions
diff --git a/package.json b/package.json
index b1e56db..6bded05 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"express": "^4.13.4",
"flexibility": "^2.0.1",
"fuzzy": "^0.1.1",
+ "iconv-lite": "^0.4.17",
"jade": "~1.11.0",
"left-pad": "^1.1.1",
"lodash": "^4.15.0",
diff --git a/routes/meetingpointProxy.js b/routes/meetingpointProxy.js
index b2b51c9..68f3fdf 100644
--- a/routes/meetingpointProxy.js
+++ b/routes/meetingpointProxy.js
@@ -1,16 +1,18 @@
-var express = require('express')
-var router = express.Router()
+const express = require('express')
+const router = express.Router()
const request = require('request')
+const iconv = require('iconv-lite')
-/* GET home page. */
router.get('/:url', function (req, res, next) {
const url = `http://www.meetingpointmco.nl/${req.params.url}`
- request(url, function (err, data) {
+ request(url, { encoding: null }, function (err, data) {
if (err) {
next(err)
return
}
- res.status(data.statusCode).end(data.body)
+
+ const utf8Body = iconv.decode(data.body, 'ISO-8859-1')
+ res.status(data.statusCode).end(utf8Body)
})
})