JavaでQuoted-printableエンコーディングをデコードする方法

Javaでは、「javax.mail.internet.MimeUtility」クラスの「decodeText()メソッド」を使って、quoted-printableエンコードをデコードできます。以下に例を示します。

import javax.mail.internet.MimeUtility;

public class QuotedPrintableDecoder {
    public static void main(String[] args) throws Exception {
        String encodedText = "Hello=20World=21"; // 替换为需要解码的quoted-printable编码字符串

        String decodedText = MimeUtility.decodeText(encodedText);
        System.out.println("Decoded Text: " + decodedText);
    }
}

上記のコードを実行すると、「Decoded Text: Hello World!」というデコード済みのテキストが出力されます。

bannerAds