{"id":22927572,"url":"https://github.com/kpym/urlencode","last_synced_at":"2025-04-01T15:43:36.650Z","repository":{"id":151030354,"uuid":"302870515","full_name":"kpym/urlencode","owner":"kpym","description":"cli tool to encode stdin to URL","archived":false,"fork":false,"pushed_at":"2023-04-25T16:39:12.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-07T10:15:29.375Z","etag":null,"topics":["cli","go","golang","url-encode"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kpym.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-10T09:57:12.000Z","updated_at":"2024-11-30T17:10:19.000Z","dependencies_parsed_at":"2024-06-21T20:27:02.763Z","dependency_job_id":null,"html_url":"https://github.com/kpym/urlencode","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpym%2Furlencode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpym%2Furlencode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpym%2Furlencode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpym%2Furlencode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kpym","download_url":"https://codeload.github.com/kpym/urlencode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246666867,"owners_count":20814605,"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":["cli","go","golang","url-encode"],"created_at":"2024-12-14T09:15:04.883Z","updated_at":"2025-04-01T15:43:36.605Z","avatar_url":"https://github.com/kpym.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# urlencode\nCli tool to encode stdin to URL.\nThis tool is a thin wrapper around the standard go escape functions `PathEscape` and `QueryEscape` from `net/url`.\n\n## Examples\n\n```console\n$ ./urlencode.exe -h\nurlencode (version: v0.7.0)\n\nThis program is a thin wrapper around the standard go url escape functions.\nAvailable flags:\n\n  -input string\n    \tstring to escape, if empty (default) read from stdin\n  -keep-spaces\n    \tkeep spaces as they are\n  -path-escape\n    \tuse PathEscape instead of QueryEscape\n  -trim\n    \ttrim (from both sides) whitespaces and newlines\n```\n\n```console\n$ urlencode -input \" Ceci est un message étrange \"\n+Ceci+est+un+message+%C3%A9trange+\n```\n\n```console\n$ echo \" Ceci est un message étrange \" | urlencode\n+Ceci+est+un+message+%C3%A9trange+%0A\n```\n\n```console\n$ echo \" Ceci est un message étrange \" | urlencode -keep-spaces\n Ceci est un message %C3%A9trange %0A\n```\n\n```console\n$ echo \" Ceci est un message étrange \" | urlencode -path-escape\n%20Ceci%20est%20un%20message%20%C3%A9trange%20%0A\n```\n\n```console\n$ echo \" Ceci est un message étrange \" | urlencode -trim\nCeci+est+un+message+%C3%A9trange\n```\n\nNote : `echo` adds a new line at the end that is visible as `%0A` if no trim option is used.\n\n## Some explanations\n\nThe url encoding is not the same before the `?` and after it.\n\n- Before the `?` the spaces should be encodes as `%20` (and not `+`). This part is encoded with `PathEscape` go function.\n- After the `?` the spaces could be encodes as `+` (`%20` is also possible but is longer ). This part is encoded with `QueryEscape` go function.\n\nFor mode info you can check [this answer](https://stackoverflow.com/a/29948396) at SX.\n\nIf you want to encode some text in `data:` uri, for example in the case of `data:image/xml+svg, ...` you can use `urlencode -path-escape -keep-spaces -trim`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpym%2Furlencode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkpym%2Furlencode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpym%2Furlencode/lists"}