加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090326051810/http://developer.android.com:80/reference/java/net/URLEncoder.html
public class

URLEncoder

extends Object
java.lang.Object
   ↳ java.net.URLEncoder

Class Overview

This class is used to encode a string using the format required by application/x-www-form-urlencoded MIME content type.

Summary

Public Methods
static String encode(String s, String enc)
This class contains a utility method for converting a string to the format required by the application/x-www-form-urlencoded MIME content type.
static String encode(String s)
This method is deprecated. use encode(String, String) instead
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static String encode (String s, String enc)

This class contains a utility method for converting a string to the format required by the application/x-www-form-urlencoded MIME content type. All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9') and characters '.', '-', '*', '_' are converted into their hexadecimal value prepended by '%'. For example: '#' -> %23 In addition, spaces are substituted by '+'

Parameters
s the string to be converted
Returns
  • the converted string

public static String encode (String s)

This method is deprecated.use encode(String, String) instead

This class contains a utility method for converting a string to the format required by the application/x-www-form-urlencoded MIME content type.

All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9') and characters '.', '-', '*', '_' are converted into their hexidecimal value prepended by '%'.

For example: '#' -> %23

In addition, spaces are substituted by '+'

Parameters
s java.lang.String the converted string
Returns
  • java.lang.String the string to be converted