0

I'm having an issue while encoding an email body using utf8 and quoted-printable

bodyHtml = utf8.decode(quotedPrintable.decode(resData['body-html']));

In heroku logs, it says

2017-05-04T05:49:54.312348+00:00 app[consumerWorker.1]: 
/app/node_modules/utf8/utf8.js:194
2017-05-04T05:49:54.312360+00:00 app[consumerWorker.1]:         throw 
Error('Invalid UTF-8 detected');
2017-05-04T05:49:54.312362+00:00 app[consumerWorker.1]:         ^
2017-05-04T05:49:54.312362+00:00 app[consumerWorker.1]: 
2017-05-04T05:49:54.312363+00:00 app[consumerWorker.1]: Error: Invalid 
UTF-8 detected

I have created a runkit, https://runkit.com/kiranlm/590abc3746b5b70012ffd7f8

Kiran LM
  • 1,359
  • 1
  • 16
  • 29

1 Answers1

0

Try this if your using english utf-8: from a terminal run

heroku config:add LANG=en_US.UTF-8

if you want to check this:

    $ heroku run bash
Running bash attached to terminal... up, run.2
u20415@022e95bf-3ab6-4291-97b1-741f95e7fbda:/app$ irb
irb(main):001:0> "a".encoding
=> #<Encoding:UTF-8>
developer_hatch
  • 15,898
  • 3
  • 42
  • 75
  • Thanks @damian-lattenero, I tried this, now the encoding is utf8 in heroku, but the error still there, – Kiran LM May 04 '17 at 06:47