Visit Mozilla.org

Referencia de JavaScript 1.5:Funciones globales:encodeURI

De MDC


Tabla de contenidos

[editar] Summary

Core Function

Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, or three escape sequences representing the UTF-8 encoding of the character.

[editar] Syntax

encodeURI(URI)

[editar] Parameters

URI 
A complete Uniform Resource Identifier.

[editar] Description

Assumes that the URI is a complete URI, so does not encode reserved characters that have special meaning in the URI.

encodeURI replaces all characters except the following with the appropriate UTF-8 escape sequences:

Type Includes
Reserved characters ; , / ? : @ & = + $
Unescaped characters alphabetic, decimal digits, - _ . ! ~ * ' ( )
Score #

Note that encodeURI by itself cannot form proper HTTP GET and POST requests, such as for XMLHTTPRequests, because "&", "+", and "=" are not encoded, which are treated as special characters in GET and POST requests. encodeURIComponent, however, does encode these characters. These behaviors are most likely not consistent across browsers.

[editar] See also

decodeURI, decodeURIComponent, encodeURIComponent