Here you can find the source of decodeText(String str)
Parameter | Description |
---|---|
str | a source string |
public static String decodeText(String str) throws UnsupportedEncodingException
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; public class Main { /**//from w w w.j av a 2s . com * Encode a string from "default.encoding" to "8859_1". * * @param str * a source string * @return encoded string. * @exception UnsupportedEncodingException * If "default.encoding" is not supported. */ public static String decodeText(String str) throws UnsupportedEncodingException { if (getEncoding() == null) return str; return encodeText(str, getEncoding(), "8859_1"); } /** * Default encoding name. * * @return Quics properties <code>quics.encoding</code> property value. If * the <code>quics.encoding</code> property value is null, return * null. */ public static String getEncoding() { return "euc-kr"; } /** * Encode a string from the specific encoding name to other encoding name. * * @param str * a source string * @param fromEnc * source string encoding name * @param toEnc * target encoding name * @return encoded string. * @exception UnsupportedEncodingException * If the named encoding is not supported. */ public static String encodeText(String str, String fromEnc, String toEnc) throws UnsupportedEncodingException { return (str == null) ? null : new String(str.getBytes(fromEnc), toEnc); } /** * Encode a string from "8859_1" to "default.encoding". * * @param str * a source string * @return encoded string. * @exception UnsupportedEncodingException * If "default.encoding" is not supported. */ public static String encodeText(String str) throws UnsupportedEncodingException { if (getEncoding() == null) return str; return encodeText(str, "8859_1", getEncoding()); } }