在nodejs中使用utf8口音

我试图用utf8编码读取一个vcf文件,结果是:

{ "name": "=4A=61=76=69=65=72=20=4C=75=6A=C3=A1=6E", "tel": "2814682382" }, 

问题是口音字符,例如áéíóú

如何将name转换为有效的utf-8string?

在上面的例子中,string必须是Javier Luján

这是Quoted Printable。

你可以安装mimielib并使用如下:

 var mimelib = require("mimelib"); json = { "name": "=4A=61=76=69=65=72=20=4C=75=6A=C3=A1=6E", "tel": "2814682382" }; name = mimelib.decodeQuotedPrintable(json.name); console.log(name); // This will print Javier Luján