TooTallNate / node-icy

Node.js module for parsing and/or injecting ICY metadata
MIT License
291 stars 48 forks source link

UTF8 Metadata #13

Closed tomasbarrios closed 9 years ago

tomasbarrios commented 10 years ago

Currently when receiving accented characters, the metadata gets weird chars. Is this possible to fix?

Like "Café Tacuba" gets parsed as "Caf� Tacuba"

romanenko commented 10 years ago

Try this PR https://github.com/TooTallNate/node-icecast/pull/15 Worked for me with the wrong-encoded metadata in stream

TooTallNate commented 10 years ago

Perhaps try something like this (note depends on the iconv-lite and chardet modules from npm)?

var iconv = require('iconv-lite');
var chardet = require('chardet');

// ... rest of code

  res.on('metadata', function (metadata) {
    var encoding = chardet.detect(metadata);
    var parsed = icecast.parse(iconv.decode(metadata, encoding));
    console.error(parsed);
  });

// ... rest of code