# URL Helpers

werkzeug.urls.uri_to_iri(uri)

  Convert a URI to an IRI. All valid UTF-8 characters are unquoted, leaving all reserved and invalid characters quoted. If the URL has a domain, it is decoded from Punycode.

      >>> uri_to_iri("http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF")
      'http://\u2603.net/p\xe5th?q=\xe8ry%DF'

  Parameters:

    uri (str) – The URI to convert.

  Return type:

    str

  Changelog

  Changed in version 3.0: Passing a tuple or bytes, and the `charset` and `errors` parameters, are removed.

  Changed in version 2.3: Which characters remain quoted is specific to each part of the URL.

  Changed in version 0.15: All reserved and invalid characters remain quoted. Previously, only some reserved characters were preserved, and invalid bytes were replaced instead of left quoted.

  Added in version 0.6.

werkzeug.urls.iri_to_uri(iri)

  Convert an IRI to a URI. All non-ASCII and unsafe characters are quoted. If the URL has a domain, it is encoded to Punycode.

      >>> iri_to_uri('http://\u2603.net/p\xe5th?q=\xe8ry%DF')
      'http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF'

  Parameters:

    iri (str) – The IRI to convert.

  Return type:

    str

  Changelog

  Changed in version 3.0: Passing a tuple or bytes, the `charset` and `errors` parameters, and the `safe_conversion` parameter, are removed.

  Changed in version 2.3: Which characters remain unquoted is specific to each part of the URL.

  Changed in version 0.15: All reserved characters remain unquoted. Previously, only some reserved characters were left unquoted.

  Changed in version 0.9.6: The `safe_conversion` parameter was added.

  Added in version 0.6.