Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/janlelis/unicode-name
Unicode character names in Ruby
https://github.com/janlelis/unicode-name
names ruby unicode unicode-data
Last synced: 3 months ago
JSON representation
Unicode character names in Ruby
- Host: GitHub
- URL: https://github.com/janlelis/unicode-name
- Owner: janlelis
- License: mit
- Created: 2016-04-13T18:36:37.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-10-01T12:52:46.000Z (about 1 year ago)
- Last Synced: 2024-07-11T18:08:21.745Z (4 months ago)
- Topics: names, ruby, unicode, unicode-data
- Language: Ruby
- Homepage:
- Size: 2.36 MB
- Stars: 13
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: MIT-LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-starred - janlelis/unicode-name - Unicode character names in Ruby (ruby)
README
# Unicode::Name [![[version]](https://badge.fury.io/rb/unicode-name.svg)](https://badge.fury.io/rb/unicode-name) [![[ci]](https://github.com/janlelis/unicode-name/workflows/Test/badge.svg)](https://github.com/janlelis/unicode-name/actions?query=workflow%3ATest)
Return Unicode codepoint names, aliases, and labels.
Unicode version: **15.1.0** (September 2023)
Supported Rubies: **3.2**, **3.1**, **3.0**
Old Rubies that might still work: **2.X**
## Usage
```ruby
require "unicode/name"# Name
Unicode::Name.of "A" # => "LATIN CAPITAL LETTER A"
Unicode::Name.of "π‘" # => "AERIAL TRAMWAY"
Unicode::Name.of "δΈ" # => "CJK UNIFIED IDEOGRAPH-4E01"
Unicode::Name.of "ν" # => "HANGUL SYLLABLE HAN"# Aliases, by type
Unicode::Name.aliases "\t" # => {:control=>["CHARACTER TABULATION", "HORIZONTAL TABULATION"],
:abbreviation=>["HT", "TAB"]}# Corrections (via .aliases[:correction], then name)
Unicode::Name.correct "A" # => "LATIN CAPITAL LETTER A"
Unicode::Name.correct "Ζ’" # => "LATIN CAPITAL LETTER GHA"# Codepoint labels
Unicode::Name.label("\0") # => ""
Unicode::Name.label("\u{D800}") # => ""
Unicode::Name.label("\u{FFFFF}") # => ""
Unicode::Name.label("\u{10C50}") # => ""# Best readable representation
Unicode::Name.readable("A") # => "LATIN CAPITAL LETTER A"
Unicode::Name.readable("\0") # => "NULL"
Unicode::Name.readable("\u{FFFFD}") # => ""
```See [unicode-sequence_names](https://github.com/janlelis/unicode-sequence_name) for character names of more complex codepoint sequences.
See [unicode-x](https://github.com/janlelis/unicode-x) for more Unicode related micro libraries.
## MIT License
- Copyright (C) 2016-2023 Jan Lelis . Released under the MIT license.
- Unicode data: https://www.unicode.org/copyright.html#Exhibit1