MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. MAF1981
    3. Best
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 5
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Character encoding of GET request response

      Ok, got it working by myself. Works like charm with iconv-lite. Found the solution here: http://stackoverflow.com/questions/12040643/nodejs-encoding-using-request

      That’s the working code section now:

      var iconv = require('iconv-lite');
      request({
      		encodeURI("http://192.168.178.11/state.cgi?device_id=" + deviceIds),
      		method: 'GET',
      		encoding: null,
      	}, function(error, response, body) {
      		var bodyWithCorrectEncoding = iconv.decode(body, 'iso-8859-1');
      		...
      

      Even the encoding: null is important! Without it does not show the specified encoding.

      BR,

      posted in Development
      MAF1981M
      MAF1981
    • 1 / 1