decode URL by UTF-8 - Android java.net

Android examples for java.net:URL

Description

decode URL by UTF-8

Demo Code

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

public class Main {

  public static String decodeURL(String str) {
    try {/*  ww  w . jav a  2s.c  o m*/
      return URLDecoder.decode(str, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
    return str;
  }

}

Related Tutorials