{"id":16696870,"url":"https://github.com/rustedbones/capturl","last_synced_at":"2025-05-16T05:32:33.385Z","repository":{"id":55879911,"uuid":"168816626","full_name":"RustedBones/capturl","owner":"RustedBones","description":"Scala/Java library for Internationalized Resource Identifier (IRIs) support","archived":false,"fork":false,"pushed_at":"2020-12-09T21:59:19.000Z","size":163,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-03T21:03:52.102Z","etag":null,"topics":["internationalization","iri","java","punycode","scala","unicode","uri","url"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RustedBones.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-02T09:40:56.000Z","updated_at":"2021-04-27T05:49:11.000Z","dependencies_parsed_at":"2022-08-15T08:30:51.111Z","dependency_job_id":null,"html_url":"https://github.com/RustedBones/capturl","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustedBones%2Fcapturl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustedBones%2Fcapturl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustedBones%2Fcapturl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustedBones%2Fcapturl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RustedBones","download_url":"https://codeload.github.com/RustedBones/capturl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254474688,"owners_count":22077344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["internationalization","iri","java","punycode","scala","unicode","uri","url"],"created_at":"2024-10-12T17:45:05.691Z","updated_at":"2025-05-16T05:32:31.455Z","avatar_url":"https://github.com/RustedBones.png","language":"Scala","readme":"# capturl\n\n[![Continuous Integration](https://github.com/RustedBones/capturl/workflows/Continuous%20Integration/badge.svg?branch=master)](https://github.com/RustedBones/capturl/actions?query=branch%3Amaster+workflow%3A\"Continuous+Integration\")\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/fr.davit/capturl_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/fr.davit/capturl_2.12)\n[![Software License](https://img.shields.io/badge/license-Apache%202-brightgreen.svg?style=flat)](LICENSE)\n\nCapturl is a Scala/Java library that provide parsers and models to work with Internationalized Resource Identifier aka \n[IRIs](https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier).\n\nThe implementation is strongly inspired by the great [`akka-http`](https://github.com/akka/akka-http) \n[Uri model](https://doc.akka.io/docs/akka-http/current/common/uri-model.html) with modularity and simplicity in mind.\n\n## Setup\n\nAdd to your `build.sbt`:\n\n```scala\nlibraryDependencies += \"fr.davit\" %% \"capturl\" % \"\u003cversion\u003e\"\n```\n\n## Parsers\n\nAll the `apply`/`create` methods accepting String input will be validated against \n[RFC 3987](https://tools.ietf.org/rfc/rfc3987.txt) compliant parsers to create the model classes.\n\n**Warning**: Exception is made for spaces in path, query and fragment which are allowed at the moment (see TODOs)\n\nIf you are sure about your input, and want to skip validation for efficiency reason, you can construct the models\nusing the implementation classes. eg:\n\n```scala\nScheme(\"b@d_scheme\") // throws a parsing exception\nScheme.Protocol(\"b@d_scheme\") // this is very wrong but will create your scheme\n```\n\n## Normalization\n\nThose are the IRI normalization steps:\n\n- Scheme\n    - lower case normalization\n- Hosts\n    - NamedHost are lower cased and decoded (punycode)\n    - IPv4 and [IPv6](https://tools.ietf.org/html/rfc5952#section-4) are normalized\n- Path\n    - collapse current folder\n    - collapse parent folder\n- Query\n    - spaces are replaced by '+'\n- Iri\n    - omit custom port if matches the scheme default port\n    - root path is added for absolute / host relative iris\n    - default port is hidden\n- General\n    - all encoded characters are decoded\n\n### IRI string interpolation\n\nAdd to your `build.sbt`:\n\n```scala\nlibraryDependencies += \"fr.davit\" %% \"capturl-contextual\" % \u003cversion\u003e\n```\n\nThis sub module provides compile time string interpolation to create IRIs:\n\n```scala\nval iri = iri\"http://localhost:8080/path?key#identifier\"\n```\n\nIf iri string is not valid, the scala compiler will notify you:\n\n```scala\nval iri = iri\"http://user{info@example.com/\"\n```\n\n```\n[error] Invalid IRI http://user{info@example.com/\n[error]     iri\"http://user{info@example.com/\"\n[error]         ^\n[error] one error found\n```\n\n\n### TODO\n\n- provide strict / relax parser mode\n- provide more normalization options\n- support holes in interpolation \n\n## capturl-akka-http\n\nAdd to your `build.sbt`:\n\n```scala\nlibraryDependencies += \"fr.davit\" %% \"capturl-akka-http\" % \u003cversion\u003e\n```\n\nThis sub module provides all the necessary implicits in [`UriConverters`](/src/main/scala/fr/davit/capturl/akka/http/UriConverters.scala) \nto go from an `Iri` to the akka `Uri` model.\n\n### TODO\n\n- provide converters for akka-http javadsl model\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustedbones%2Fcapturl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustedbones%2Fcapturl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustedbones%2Fcapturl/lists"}