Share via


The URI to be decoded is not a valid encoding

You attempted to decode an improperly formed URI (Uniform Resource Identifier). URIs have a special syntax; most non-alphanumeric characters must be encoded before they can be used in a URI. You can use the encodeURI and encodeURIComponent methods to create a URI from a normal JavaScript string.

A complete URI is composed of a sequence of components and separators. The general form is:

<Scheme>:<first>/<second>;<third>?<fourth>  

The names in angle brackets represent components, and the ":", "/", ";" and "?" are reserved characters used as separators.

To correct this error

  • Ensure you are trying to decode valid URIs only. You cannot decode normal JavaScript strings, as they may contain invalid characters.

See also

decodeURI Function
decodeURIComponent Function