fix: IRI to URI conversion by aucampia · Pull Request #2304 · RDFLib/rdflib (original) (raw)
Summary of changes
The URI to IRI conversion was percentage-quoting characters that should not have been quoted, like equals in the query string. It was also not quoting things that should have been quoted, like the username and password components of a URI.
This change improves the conversion by only quoting characters that are not allowed in specific parts of the URI and quoting previously unquoted components. The safe characters for each segment are taken from RFC3986.
The new behavior is heavily inspired by
werkzeug.urls.iri_to_uri though there are some differences.
Checklist
- Checked that there aren't other open pull requests for
the same change. - Added tests for any changes that have a runtime impact.
- Checked that all tests and type checking passes.
- Considered granting push permissions to the PR branch,
so maintainers can fix minor issues and keep your PR up to date.