Java String Encode encodeText(String str)

Here you can find the source of encodeText(String str)

Description

encode string with RFC2047

License

Open Source License

Declaration

public static String encodeText(String str) 

Method Source Code


//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);
        }
    }
}

Related

  1. encodeString(String str)
  2. encodeString(String strData)
  3. encodeString(String text, String charsetName)
  4. encodeString(String value)
  5. encodeStringByUTF8(String str)
  6. encodeText(String str, String fromEnc, String toEnc)
  7. encodeTexts(String s)
  8. encodeTextValue(char[] characters, int offset, int length, Writer writer)
  9. encodeThoroughly(String s)