encode URL by UTF-8 - Android java.net

Android examples for java.net:URL

Description

encode URL by UTF-8

Demo Code

import java.net.URLEncoder;

public class Main {

  public static String enCodeRUL(String str) {
    try {// w w  w.  jav  a  2 s . c o m
      return URLEncoder.encode(str, "UTF-8");
    } catch (Exception ex) {
    }
    return str;
  }

}

Related Tutorials