我正在尝试解码一些出现在Mbox电子邮件存档中的Quoted-Printable编码文本。以下是我遇到困难的一个例子。
在MBox中,出现了以下文本:
"Demarcation by Theresa Castel=E3o-Lawless"
正确解码后,我认为应该显示为:
"Demarcation by Theresa Castelão-Lawless"
我说它应该正确显示的依据是:
1)电子邮件的Web存档中文本的正确呈现为"Demarcation by Theresa Castelão-Lawless"
2)此页面将“= E3”显示为Quoted-Printable对应的“ã”https://www.ic.unicamp.br/~stolfi/EXPORT/www/ISO-8859-1-Encoding.html
我尝试了下面的代码,但它给出了错误的输出。
string = "Demarcation by Theresa Castel=E3o-Lawless"
decoded_string = Mail::Encodings::QuotedPrintable.decode(string)
puts decoded_string + "\n"
上面代码的结果是“Demarcation by Theresa Castel?o-Lawless”,但就像之前所述,我想要“Demarcation by Theresa Castelão-Lawless”。