Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
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.

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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static String encode ( String s, String charsetName)

Added in API level 1

Encodes s using the Charset named by charsetName .

public static String encode ( String s)

Added in API level 1

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

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