Get a decoder for the given charset.
6415
public static Decoder get(Charset charset) throws Exception {
		Class<? extends Decoder> cl = decoders.get(charset.name());
		if (cl == null) {
			CharsetDecoder decoder = charset.newDecoder();
			decoder.onMalformedInput(CodingErrorAction.REPLACE);
			decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
			return new DefaultDecoder(decoder);
		}
		return cl.newInstance();
	}
189809
def GetDecoder(cls, encoding_method):
    
    encoding_method = encoding_method.lower()
    decoder = cls._decoders.get(encoding_method, None)
    if not decoder:
      return None

    return decoder()
1372903
def guess_encoding(text, default=DEFAULT_ENCODING):
    
    result = chardet.detect(text)
    return normalize_result(result, default=default)
762499
def from_chars(cls, chars='', optimal=3):
        """"""
        if not chars:
            chars = ''.join(ALNUM)
        sets = most_even_chunk(chars, optimal)
        return cls(sets)
652960
def unicoder(p):
    
    if isinstance(p, unicode):
        return p
    if isinstance(p, str):
        return decoder(p)
    else:
        return unicode(decoder(p))
742856
public static CharsetEncoder encoder(Charset charset) {
        checkNotNull(charset, "charset");

        Map<Charset, CharsetEncoder> map = InternalThreadLocalMap.get().charsetEncoderCache();
        CharsetEncoder e = map.get(charset);
        if (e != null) {
            e.reset().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE);
            return e;
        }

        e = encoder(charset, CodingErrorAction.REPLACE, CodingErrorAction.REPLACE);
        map.put(charset, e);
        return e;
    }
143119
public static String decodeString(String encoded,String charset)
    {
        return decodeString(encoded,0,encoded.length(),charset);
    }
1050057
public static String decode(final String str, final String charsetName) throws UnsupportedEncodingException {
		return decode(new String(str.getBytes(charsetName), "UTF-8"));
	}
652106
def parse_charset(charset):
    
    import re
    regex = r'(\w-\w)'
    pat = re.compile(regex)
    found = pat.findall(charset)
    result = ''
    if found:
        for element in found:
            for char in char_range(element[0], element[-1]):
                result += char
        return result
    return charset
968869
public static String decode(String value, Charset charset) {
    try {
      /* there is nothing special between uri and url decoding */
      return URLDecoder.decode(value, charset.name());
    } catch (UnsupportedEncodingException uee) {
      /* since the encoding is not supported, return the original value */
      return value;
    }
  }
151671
public static Character decodeCharacterObj(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            int b = src[srcOffset];
            if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
                return null;
            }
            return decodeChar(src, srcOffset + 1);
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }
1254423
public RawResponse charset(Charset charset) {
        return new RawResponse(method, url, statusCode, statusLine, cookies, headers, body, charset, decompress);
    }
641363
public static String decodeToString(String encoded, String charset) throws CoderException, UnsupportedEncodingException {
	byte[] dec = decode(Caster.toString(encoded, null));
	return new String(dec, charset);
    }
777451
def decode(self, charset='utf-8', errors='replace'):
        
        return URL(
            self.scheme.decode('ascii'),
            self.decode_netloc(),
            self.path.decode(charset, errors),
            self.query.decode(charset, errors),
            self.fragment.decode(charset, errors)
        )
1255565
public static String string(ByteBuffer buffer, Charset charset) throws CharacterCodingException {
        try {
            return charset.newDecoder().decode(buffer.duplicate()).toString();
        } catch (CharacterCodingException e) {
            throw Exceptions.runtime(e);
        }
    }
523607
def set_charset(self, charset):
        """"""
        self.head.charset.attr(charset=charset)
        return self
703009
public static String decode(final String input) {
		return new String(decode(input.getBytes(charsetISOLatin1)), charsetUTF8);
	}