{"id":31799973,"url":"https://github.com/janlelis/unibits","last_synced_at":"2025-10-10T22:57:22.256Z","repository":{"id":56897181,"uuid":"83977069","full_name":"janlelis/unibits","owner":"janlelis","description":"Visualize different Unicode encodings in the terminal","archived":false,"fork":false,"pushed_at":"2025-09-12T20:00:52.000Z","size":1588,"stargazers_count":128,"open_issues_count":0,"forks_count":3,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-09-12T22:36:57.856Z","etag":null,"topics":["ascii","cli-command","codepoints","debugging-tool","hacktoberfest","ruby-cli","terminal","unicode","utf-16","utf-32","utf-8"],"latest_commit_sha":null,"homepage":"https://character.construction","language":"Ruby","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/janlelis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-03-05T14:40:25.000Z","updated_at":"2025-09-12T20:00:56.000Z","dependencies_parsed_at":"2024-09-14T05:03:55.135Z","dependency_job_id":"79b9a402-0581-4ac8-b0f8-d3813fa543d9","html_url":"https://github.com/janlelis/unibits","commit_stats":{"total_commits":124,"total_committers":2,"mean_commits":62.0,"dds":"0.15322580645161288","last_synced_commit":"63497360ef2d62456673ae56b14ac9b44d2592ba"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/janlelis/unibits","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funibits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funibits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funibits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funibits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janlelis","download_url":"https://codeload.github.com/janlelis/unibits/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funibits/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002359,"owners_count":26083357,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ascii","cli-command","codepoints","debugging-tool","hacktoberfest","ruby-cli","terminal","unicode","utf-16","utf-32","utf-8"],"created_at":"2025-10-10T22:57:21.354Z","updated_at":"2025-10-10T22:57:22.251Z","avatar_url":"https://github.com/janlelis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unibits | Reveal the Unicode [![[version]](https://badge.fury.io/rb/unibits.svg)](https://badge.fury.io/rb/unibits)  [![[ci]](https://github.com/janlelis/unibits/workflows/Test/badge.svg)](https://github.com/janlelis/unibits/actions?query=workflow%3ATest)\n\nRuby library and CLI command that visualizes various Unicode and ASCII/single byte encodings in the terminal:\n\n- Makes analyzing encodings easier\n- Helps you with debugging strings\n- Highlights invalid/special/blank bytes/characters/codepoints\n- Supports *UTF-8*, *UTF-16LE*/*UTF-16BE*, *UTF-32LE*/*UTF-32BE*, *ISO-8859-X*, *Windows-125X*, *IBMX*, *CP85X*, *macX*, *TIS-620*/*Windows-874*, *KOI8-R*/*KOI8-U*, 7-Bit *ASCII*/*GB1988*, and arbitrary *BINARY* data\n\n## Color Coding\n\nEach byte of the given string is highlighted using the following mechanism (characters -\u003e codepoints):\n\n- Red for invalid bytes\n- Light blue for blanks\n- Blue for control characters\n- Non-control formatting characters in pink\n- Green for marks (Unicode only)\n- Orange for unassigned codepoints\n- Lighter orange for unassigned codepoints which are also ignorable\n- Random color for all other codepoints\n\nThe same colors are used in the higher-level companion tool [uniscribe](https://github.com/janlelis/uniscribe).\n\n## Setup\n\nMake sure you have Ruby installed and installing gems works properly. Then do:\n\n```\n$ gem install unibits\n```\n\n## Usage\n\nPass the string to debug to unibits:\n\n### From CLI\n\n```\n$ unibits \"🌫 Idio﻿syncrätic ℜսᖯʏ\"\n```\n\n### From Ruby\n\n```ruby\nrequire 'unibits/kernel_method'\nunibits \"🌫 Idio﻿syncrätic ℜսᖯʏ\"\n```\n\n### Advanced Options\n\n`unibits` takes some optional options:\n\n- *encoding (e)*: The encoding of the given string (uses the string's default encoding if none given)\n- *convert (c)*: An encoding the string should be converted to before visualizing it\n- *stats*: Whether to show a short stats header (default: `true`), you can deactivate on the CLI with `--no-stats`\n- *wide-ambiguous*: Treat characters of ambiguous width as 2 spaces instead of 1 ([more info](https://github.com/janlelis/unicode-display_width))\n- *width (w)*: Set a custom column width, if not set, *unibits* will retrieve it from the terminal or just use 80\n\n## Examples of Valid Encodings\n### UTF-8\n\nCLI: `$ unibits -e utf-8 -c utf-8 \"🌫 Idio﻿syncrätic ℜսᖯʏ\"`\n\nRuby: `unibits \"🌫 Idio﻿syncrätic ℜսᖯʏ\", encoding: 'utf-8', convert: 'utf-8'`\n\n![Screenshot UTF-8](/screenshots/utf-8.png?raw=true \"UTF-8\")\n\n### UTF-16LE\n\nCLI: `$ unibits -e utf-8 -c utf-16le \"🌫 Idio﻿syncrätic ℜսᖯʏ\"`\n\nRuby: `unibits \"🌫 Idio﻿syncrätic ℜսᖯʏ\", encoding: 'utf-8', convert: 'utf-16le'`\n\n![Screenshot UTF-16LE](/screenshots/utf-16le.png?raw=true \"UTF-16LE\")\n\n### UTF-32BE\n\nCLI: `$ unibits -e utf-8 -c utf-32be \"🌫 Idio﻿syncrätic ℜսᖯʏ\"`\n\nRuby: `unibits \"🌫 Idio﻿syncrätic ℜսᖯʏ\", encoding: 'utf-8', convert: 'utf-32be'`\n\n![Screenshot UTF-32BE](/screenshots/utf-32be.png?raw=true \"UTF-32BE\")\n\n### BINARY\n\nCLI: `$ unibits -e binary \"🌫 Idio﻿syncrätic ℜսᖯʏ\"`\n\nRuby: `unibits \"🌫 Idio﻿syncrätic ℜսᖯʏ\", encoding: 'binary'`\n\n![Screenshot BINARY](/screenshots/binary.png?raw=true \"BINARY\")\n\n### ASCII\n\nCLI: `$ unibits -e utf-8 -c ascii \"ascii\"`\n\nRuby: `unibits \"ascii\", encoding: 'utf-8', convert: 'ascii'`\n\n![Screenshot ASCII](/screenshots/ascii.png?raw=true \"ASCII\")\n\n## Examples of Invalid Encodings\n### UTF-8\n\nExample in Ruby: `unibits \"unexpected \\x80 | not enough \\xF0\\x9F\\x8C | overlong \\xE0\\x81\\x81 | surrogate \\xED\\xA0\\x80 | too large \\xF5\\x8F\\xBF\\xBF\"`\n\n![Screenshot invalid UTF-8](/screenshots/utf-8.invalid.png?raw=true \"Invalid UTF-8\")\n\n### ASCII\n\nExample in Ruby: `unibits \"🌫 Idio﻿syncrätic ℜսᖯʏ\", encoding: 'ascii'`\n\n![Screenshot invalid ASCII](/screenshots/ascii.invalid.png?raw=true \"Invalid ASCII\")\n\n## Notes\n\nMore info\n\n- [Ruby's Encoding class](https://ruby-doc.org/core/Encoding.html)\n- [UTF-8 (Wikipedia)](https://en.wikipedia.org/wiki/UTF-8#Description)\n- [UTF-16 (Wikipedia)](https://en.wikipedia.org/wiki/UTF-16#Description)\n- [UTF-32 (Wikipedia)](https://en.wikipedia.org/wiki/UTF-32)\n- [Difference between BINARY and ASCII](http://idiosyncratic-ruby.com/56-us-ascii-8bit.html)\n\nRelated gems\n\n- [uniscribe](https://github.com/janlelis/uniscribe)\n- [unicopy](https://github.com/janlelis/unicopy)\n- [symbolify](https://github.com/janlelis/symbolify)\n- [characteristics](https://github.com/janlelis/characteristics)\n\nLots of thanks to @damienklinnert for the motivation and inspiration required to build this! 🎆\n\nCopyright (C) 2017-2024 Jan Lelis \u003chttps://janlelis.com\u003e. Released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlelis%2Funibits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanlelis%2Funibits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlelis%2Funibits/lists"}