{"id":18877467,"url":"https://github.com/pablohirafuji/elm-char-codepoint","last_synced_at":"2025-06-20T23:32:40.847Z","repository":{"id":62418876,"uuid":"84594909","full_name":"pablohirafuji/elm-char-codepoint","owner":"pablohirafuji","description":"Code point operations in Elm","archived":false,"fork":false,"pushed_at":"2017-03-17T19:28:22.000Z","size":119,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T04:33:13.358Z","etag":null,"topics":["char","codepoints","elm"],"latest_commit_sha":null,"homepage":"http://package.elm-lang.org/packages/pablohirafuji/elm-char-codepoint/latest","language":"Elm","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/pablohirafuji.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":"2017-03-10T19:43:00.000Z","updated_at":"2017-03-17T00:41:21.000Z","dependencies_parsed_at":"2022-11-01T16:46:25.209Z","dependency_job_id":null,"html_url":"https://github.com/pablohirafuji/elm-char-codepoint","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/pablohirafuji/elm-char-codepoint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablohirafuji%2Felm-char-codepoint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablohirafuji%2Felm-char-codepoint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablohirafuji%2Felm-char-codepoint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablohirafuji%2Felm-char-codepoint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pablohirafuji","download_url":"https://codeload.github.com/pablohirafuji/elm-char-codepoint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablohirafuji%2Felm-char-codepoint/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261036225,"owners_count":23100893,"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":["char","codepoints","elm"],"created_at":"2024-11-08T06:19:15.240Z","updated_at":"2025-06-20T23:32:35.834Z","avatar_url":"https://github.com/pablohirafuji.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Code Point\n\nConvert char to code point and code point to string, similar to javascript's `String.codePointAt` and `String.fromCodePoint`. [Demo](https://pablohirafuji.github.io/elm-char-codepoint/).\n\n## What's the difference between `Char.toCode` and `Char.CodePoint.fromChar`?\n\nFrom [MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt):\n\n\u003e The `charCodeAt()` method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index (the UTF-16 code unit matches the Unicode code point for code points representable in a single UTF-16 code unit, but might also be the first code unit of a surrogate pair for code points not representable in a single UTF-16 code unit, e.g. Unicode code points \u003e 0x10000). If you want the entire code point value, use `codePointAt()`.\n\nThis mean that not all chars exists in a single 16 bits representation, and `Char.toCode` only returns the first 16 bits code of any given char.\n\nHere is an example to demonstrate how this can affect the output of `Char.toCode` and how `Char.CodePoint.fromChar` fix that:\n\n```elm\nChar.toCode '𝔸' == 55349\nChar.fromCode 55349 == '�'\n\n\nChar.CodePoint.fromChar '𝔸' == 120120\nChar.CodePoint.toString 120120 == \"𝔸\"\n```\n\nYou can try different chars in this [demo](https://pablohirafuji.github.io/elm-char-codepoint/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpablohirafuji%2Felm-char-codepoint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpablohirafuji%2Felm-char-codepoint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpablohirafuji%2Felm-char-codepoint/lists"}