# encodeComponent method

String encodeComponent (String component)

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 the 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.

For encoding the query part consider using encodeQueryComponent.

To avoid the need for explicitly encoding use the pathSegments and queryParameters optional named arguments when constructing a Uri.

## Implementation

    static String encodeComponent(String component) {
      return _Uri._uriEncode(_Uri._unreserved2396Table, component, utf8, false);
    }