Skip to content

Most visited

Recently visited

navigation
Added in API level 1

URLEncoder

public class URLEncoder
extends Object

java.lang.Object
   ↳ java.net.URLEncoder


This class is used to encode a string using the format required by 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 '+'.

Summary

Public methods

static String encode(String s, String charsetName)

Encodes s using the Charset named by charsetName.

static String encode(String s)

This method was deprecated in API level 1. Use encode(String, String) instead.

Inherited methods

From class java.lang.Object

Public methods

encode

Added in API level 1
String encode (String s, 
                String charsetName)

Encodes s using the Charset named by charsetName.

Parameters
s String
charsetName String
Returns
String
Throws
UnsupportedEncodingException

encode

Added in API level 1
String encode (String s)

This method was deprecated in API level 1.
Use encode(String, String) instead.

Equivalent to encode(s, "UTF-8").

Parameters
s String
Returns
String
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.