Skip to content
Snippets Groups Projects
Commit e2ce2c78 authored by Kasalehlia's avatar Kasalehlia
Browse files

efa.de switched to UTF-8 from latin1 (thank god)

parent 8451d445
No related branches found
No related tags found
No related merge requests found
var fs = require('fs'); var fs = require('fs');
var Mustache = require('mustache'); var Mustache = require('mustache');
var XML = require('pixl-xml'); var XML = require('pixl-xml');
var iconv = require('iconv-lite');
var httpreq = require('httpreq'); var httpreq = require('httpreq');
/// CONFIG /// CONFIG
...@@ -30,7 +29,7 @@ function fetchData(stop, cb) { ...@@ -30,7 +29,7 @@ function fetchData(stop, cb) {
var url = "http://62.154.206.87/efaws2/default/XML_DM_REQUEST?sessionID=0&requestID=0&language=de&useRealtime=1&coordOutputFormat=WGS84[DD.ddddd]&locationServerActive=1&mode=direct&dmLineSelectionAll=1&depType=STOPEVENTS&useAllStops=1&command=null&type_dm=stop&name_dm="+CITY+' '+stop+"&mId=efa_rc2" var url = "http://62.154.206.87/efaws2/default/XML_DM_REQUEST?sessionID=0&requestID=0&language=de&useRealtime=1&coordOutputFormat=WGS84[DD.ddddd]&locationServerActive=1&mode=direct&dmLineSelectionAll=1&depType=STOPEVENTS&useAllStops=1&command=null&type_dm=stop&name_dm="+CITY+' '+stop+"&mId=efa_rc2"
httpreq.get(url, {binary: true}, function (err, res) { httpreq.get(url, {binary: true}, function (err, res) {
try { try {
cb(XML.parse(iconv.decode(res.body, 'latin1'))); cb(XML.parse(res.body));
} catch(e) { } catch(e) {
} }
}); });
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
"express": "^4.13.3", "express": "^4.13.3",
"httpreq": "^0.4.13", "httpreq": "^0.4.13",
"ical.js": "^1.1.2", "ical.js": "^1.1.2",
"iconv-lite": "^0.4.13",
"irc": "^0.4.0", "irc": "^0.4.0",
"ms": "^0.7.1", "ms": "^0.7.1",
"mustache": "^2.2.0", "mustache": "^2.2.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment