{"id":13837845,"url":"https://github.com/figsoda/utf8","last_synced_at":"2025-04-30T12:02:47.385Z","repository":{"id":170473612,"uuid":"646613656","full_name":"figsoda/utf8","owner":"figsoda","description":"UTF-8 support for Nix","archived":false,"fork":false,"pushed_at":"2024-03-13T22:56:32.000Z","size":47,"stargazers_count":49,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-15T23:14:01.093Z","etag":null,"topics":["encoding","nix","string","text","unicode","utf","utf-8","utf8"],"latest_commit_sha":null,"homepage":"https://discourse.nixos.org/t/28530","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/figsoda.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-05-28T23:59:36.000Z","updated_at":"2024-08-04T15:49:16.214Z","dependencies_parsed_at":"2024-02-19T22:32:25.838Z","dependency_job_id":"18cd8bbd-d15f-4983-a266-405f664bdf8b","html_url":"https://github.com/figsoda/utf8","commit_stats":null,"previous_names":["figsoda/utf8"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figsoda%2Futf8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figsoda%2Futf8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figsoda%2Futf8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figsoda%2Futf8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/figsoda","download_url":"https://codeload.github.com/figsoda/utf8/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251697443,"owners_count":21629418,"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":["encoding","nix","string","text","unicode","utf","utf-8","utf8"],"created_at":"2024-08-04T15:01:28.104Z","updated_at":"2025-04-30T12:02:47.335Z","avatar_url":"https://github.com/figsoda.png","language":"Nix","funding_links":[],"categories":["Command-Line Tools","Nix"],"sub_categories":[],"readme":"# utf8\n\nUTF-8 support for Nix\n\n## Why\n\nStrings in Nix are byte strings, and builtin functions like `substring`\n(and by extension some `lib` functions in [nixpkgs](https://github.com/nixos/nixpkgs))\nprocesses bytes instead of UTF-8 code points.\nThat means these functions can create invalid strings when given strings with UTF-8.\nThis library basically allows you to convert it to a list of UTF-8 code points.\n\n## Usage\n\nTry it out with flakes\n\n```bash\nnix repl github:figsoda/utf8#lib --extra-experimental-features \"flakes nix-command repl-flake\"\n```\n\nor locally\n\n```bash\nnix repl -f .\n```\n\n### `chars`\n\nType: `String -\u003e [ String ]`\n\nSplit a string into a list of code points\n\n```\nnix-repl\u003e chars \"你好，世界！\"\n[ \"你\" \"好\" \"，\" \"世\" \"界\" \"！\" ]\n```\n\n### `head`\n\nType: `String -\u003e String`\n\nReturn the first code point of the string\n\n```\nnix-repl\u003e head \"你好，世界！\"\n\"你\"\n```\n\n### `tail`\n\nType: `String -\u003e String`\n\nReturn the string without the first code point\n\n```\nnix-repl\u003e tail \"你好，世界！\"\n\"好，世界！\"\n```\n\n### `length`\n\nType: `String -\u003e Int`\n\nReturn the number of code points in the string\n\n```\nnix-repl\u003e length \"你好，世界！\"\n6\n```\n\n## Development\n\n```bash\nnix run ./dev # regenerate table.nix\n\nnix develop ./dev\nnamaka check # run tests\nnamaka review # review pending snapshots\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffigsoda%2Futf8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffigsoda%2Futf8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffigsoda%2Futf8/lists"}