0

我在使用utf8和编码电子邮件正文时遇到问题quoted-printable

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

在heroku日志中,它说

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

我创建了一个 runkit,https ://runkit.com/kiranlm/590abc3746b5b70012ffd7f8

4

1 回答 1

0

如果您使用英语 utf-8,请尝试此操作:从终端运行

heroku config:add LANG=en_US.UTF-8

如果你想检查这个:

    $ 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>
于 2017-05-04T06:10:13.127 回答