class DartURI
- DartURI
- Reference
- Object
Defined in:
extern/dart_uri.crClass Method Summary
-
.encode_component(component : String) : String
Encode the string component using percent-encoding to make it safe for literal use as a URI component.
-
.encode_full(uri : String) : String
Encodes the string uri using percent-encoding to make it safe for literal use as a full URI.
Class Method Detail
Encode the string component using percent-encoding to make it safe for literal use as a URI component.
All characters except uppercase and lowercase letters, digits and
the characters -_.!~*'()
are percent-encoded. This is the
set of characters specified in RFC 2396 and which is
specified for the encodeUriComponent in ECMA-262 version 5.1.
When manually encoding path segments or query components, remember to encode each part separately before building the path or query string.
Example:
request = "http://example.com/search=Crystal"
encoded = DartURI.encode_component(request)
puts encoded # => http%3A%2F%2Fexample.com%2Fsearch%3DCrystal
Encodes the string uri using percent-encoding to make it safe for literal use as a full URI.
All characters except uppercase and lowercase letters, digits, and the
characters !#$&'()*+,-./:;=?@_~
are percent-encoded. This is the set of
characters specified in ECMA-262 version 5.1 for the encodeURI function.
NOTE This is a Crystal port of the Dart Uri.encodeFull method (src).