Here you can find the source of encodeText(String str)
public static String encodeText(String str)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import javax.mail.internet.MimeUtility; public class Main { /**//ww w . j a v a 2 s . c o m * encode string with RFC2047 */ public static String encodeText(String str) { //ToDo remove JavaMail dependency. try { return MimeUtility.encodeText(str, "utf-8", "B"); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } } }