encodeQueryComponent method
String encodeQueryComponent(Encode the string component
according to the HTML 4.01 rules for encoding the posting of a HTML form as a query string component.
Encode the string component
according to the HTML 4.01 rules for encoding the posting of a HTML form as a query string component.
The component is first encoded to bytes using encoding
. The default is to use UTF8 encoding, which preserves all the characters that don't need encoding.
Then the resulting bytes are "percent-encoded". This transforms spaces (U+0020) to a plus sign ('+') and all bytes that are not the ASCII decimal digits, letters or one of '-._~' are written as a percent sign '%' followed by the two-digit hexadecimal representation of the byte.
Note that the set of characters which are percent-encoded is a superset of what HTML 4.01 requires, since it refers to RFC 1738 for reserved characters.
When manually encoding query components remember to encode each part separately before building the query string.
To avoid the need for explicitly encoding the query use the queryParameters optional named arguments when constructing a Uri.
See http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 for more details.
Source
static String encodeQueryComponent(String component, {Encoding encoding: UTF8}) { return _Uri._uriEncode(_Uri._unreservedTable, component, encoding, true); }
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-core/Uri/encodeQueryComponent.html