{"id":16980963,"url":"https://github.com/guzba/unicody","last_synced_at":"2025-03-21T23:26:11.414Z","repository":{"id":195260087,"uuid":"692517273","full_name":"guzba/unicody","owner":"guzba","description":"An alternative / companion to Nim's std/unicode and std/strutils.","archived":false,"fork":false,"pushed_at":"2024-12-22T18:13:01.000Z","size":112,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T17:46:49.522Z","etag":null,"topics":["nim","unicode","utf-8","utf8"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/guzba.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":"2023-09-16T18:10:43.000Z","updated_at":"2024-12-22T08:35:53.000Z","dependencies_parsed_at":"2024-02-18T09:23:41.959Z","dependency_job_id":"525f6ec2-f319-4f38-bafa-008750e827f3","html_url":"https://github.com/guzba/unicody","commit_stats":{"total_commits":45,"total_committers":1,"mean_commits":45.0,"dds":0.0,"last_synced_commit":"e60edd329ae8ff3819663cdaac6903df6d86b1b5"},"previous_names":["guzba/unicody"],"tags_count":7,"template":false,"template_full_name":"treeform/nimtemplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzba%2Funicody","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzba%2Funicody/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzba%2Funicody/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guzba%2Funicody/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guzba","download_url":"https://codeload.github.com/guzba/unicody/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244882246,"owners_count":20525824,"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":["nim","unicode","utf-8","utf8"],"created_at":"2024-10-14T02:04:15.383Z","updated_at":"2025-03-21T23:26:11.392Z","avatar_url":"https://github.com/guzba.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unicody\n\n`nimble install unicody`\n\n[API reference](https://guzba.github.io/unicody/)\n\nUnicody is an alternative to Nim's std/unicode module that is entirely focused on UTF-8.\n\nWhy create an alternative? Two primary motivating reasons:\n* Currently, std/unicode handles invalid UTF-8 incorrectly. See [1](https://github.com/nim-lang/Nim/issues/10750) and [2](https://github.com/nim-lang/Nim/issues/19333).\n* Working with UTF-8 for a web server has lead me to wanting different behavior and additional procs.\n\nI created `unicody` so these changes and additions have a place to live and so all of my own projects can make use of this module.\n\nUnicody is written entirely in Nim so no external linking, deps, compiler flags, or whatever is necessary.\n\n### Drop-in replacement\n\nA goal for Unicody is to be a drop-in replacement for std/unicode. To enable this, Unicody matches proc signatures where alternative implementations have been written.\n\nCurrently Unicody does not have implementations for most procs in std/unicode so it is not correct to say that Unicody is a complete drop-in replacement for everything.\n\nWhile Unicody does not have every proc covered, a core set of procs are implemented that enable quite a lot of use-cases.\n\n### Compatibility with std/unicode\n\nUnicody does not currently have an implementation of most procs in std/unicode. For this reason, and for avoiding unnecessary annoyance, Unicody is set up to work co-operatively with std/unicode. You can import both and `Rune` is the same everywhere so you can mix and match procs as needed.\n\nNote that you may need to specify which version of some procs you want to call if you import both, eg `unicody.validateUtf8` vs just `validateUtf8`.\n\n## Examples\n\n```nim\ndoAssert truncateUtf8(\"🔒🔒🔒🔒🔒🔒🔒🔒🔒🔒\", maxBytes = 10) == \"🔒🔒\"\n```\n\n```nim\ndoAssert validateUtf8(\"abc🔒def\") == -1 # Matches std/unicode proc signature\n```\n\n```nim\nlet rune = \"🔒\".validRuneAt(0) # Returns Option[Rune]\ndoAssert rune.isSome # A valid rune was found starting at offset 0\n```\n\n## Testing\n\n`nimble test`\n\nTo prevent Unicody from causing a crash or otherwise misbehaving on bad input data, a fuzzer has been run against it. You can run the fuzzer any time by running `nim c -r tests/fuzz.nim`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguzba%2Funicody","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguzba%2Funicody","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguzba%2Funicody/lists"}