All Projects β†’ janlelis β†’ characteristics

janlelis / characteristics

Licence: MIT license
Character info under different encodings

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to characteristics

Portable Utf8
πŸ‰‘ Portable UTF-8 library - performance optimized (unicode) string functions for php.
Stars: ✭ 405 (+1520%)
Mutual labels:  unicode, ascii, utf-8
Unibits
Visualize different Unicode encodings in the terminal
Stars: ✭ 125 (+400%)
Mutual labels:  unicode, ascii, utf-8
p8-programming-fonts
A collection of fonts I've modified for PICO-8 programming.
Stars: ✭ 67 (+168%)
Mutual labels:  ascii, iso8859, windows1252
Transliteration
UTF-8 to ASCII transliteration / slugify module for node.js, browser, Web Worker, React Native, Electron and CLI.
Stars: ✭ 444 (+1676%)
Mutual labels:  unicode, ascii, utf-8
homoglyphs
Homoglyphs: get similar letters, convert to ASCII, detect possible languages and UTF-8 group.
Stars: ✭ 70 (+180%)
Mutual labels:  unicode, ascii, utf-8
utf8-validator
UTF-8 Validator
Stars: ✭ 18 (-28%)
Mutual labels:  unicode, utf-8
Slug Generator
Slug Generator Library for PHP, based on Unicode’s CLDR data
Stars: ✭ 740 (+2860%)
Mutual labels:  unicode, ascii
Weird Json
A collection of strange encoded JSONs. For connoisseurs.
Stars: ✭ 53 (+112%)
Mutual labels:  unicode, ascii
Voca rs
Voca_rs is the ultimate Rust string library inspired by Voca.js, string.py and Inflector, implemented as independent functions and on Foreign Types (String and str).
Stars: ✭ 167 (+568%)
Mutual labels:  unicode, utf-8
Lehar
Visualize data using relative ordering
Stars: ✭ 81 (+224%)
Mutual labels:  unicode, ascii
table2ascii
Python library for converting lists to fancy ASCII tables for displaying in the terminal and on Discord
Stars: ✭ 31 (+24%)
Mutual labels:  unicode, ascii
Awesome Unicode
πŸ˜‚ πŸ‘Œ A curated list of delightful Unicode tidbits, packages and resources.
Stars: ✭ 693 (+2672%)
Mutual labels:  unicode, utf-8
Urlify
A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.
Stars: ✭ 633 (+2432%)
Mutual labels:  unicode, ascii
Unicopy
Unicode command-line codepoint dumper
Stars: ✭ 16 (-36%)
Mutual labels:  unicode, utf-8
Cowsay Files
A collection of additional/alternative cowsay files.
Stars: ✭ 216 (+764%)
Mutual labels:  unicode, ascii
Diagon
Interactive ASCII art diagram generators. 🌟
Stars: ✭ 189 (+656%)
Mutual labels:  unicode, ascii
jurl
Fast and simple URL parsing for Java, with UTF-8 and path resolving support
Stars: ✭ 84 (+236%)
Mutual labels:  unicode, utf-8
Bstr
A string type for Rust that is not required to be valid UTF-8.
Stars: ✭ 348 (+1292%)
Mutual labels:  unicode, utf-8
Tomlplusplus
Header-only TOML config file parser and serializer for C++17 (and later!).
Stars: ✭ 403 (+1512%)
Mutual labels:  unicode, utf-8
Stringz
πŸ’― Super fast unicode-aware string manipulation Javascript library
Stars: ✭ 181 (+624%)
Mutual labels:  unicode, utf-8

Characteristics [version] [ci]

A Ruby library that provides additional info about characters:ΒΉ

  • Could a character be invisible (blank)?
  • Is a character assigned?
  • Is a character a special control character?

Extra data is available for Unicode characters (see below).

The unibits and uniscribe gems makes use of this data to visualize it accordingly.

ΒΉ in the sense of codepoints

Setup

Add to your Gemfile:

gem 'characteristics'

Usage

# All supported encodings
char_info = Characteristics.create(character)
char_info.valid? # => true / false
char_info.unicode? # => true / false
char_info.assigned? # => true / false
char_info.control? # => true / false
char_info.blank? # => true / false
char_info.separator? # => true / false
char_info.format? # => true / false

# Unicode characters
char_info = Characteristics.create(character)
char_info.variation_selector? # => true / false
char_info.tag? # => true / false
char_info.ignorable? # => true / false
char_info.noncharacter? # => true / false

Types of Encodings

This library knows of four different kinds of encodings:

  • :unicode Unicode familiy of multi-byte encodings
    • UTF-X
  • :byte Known single-byte encoding
    • ISO-8859-X, Windows-125X, IBMX, CP85X, macX, TIS-620, Windows-874, KOI-X
  • :ascii 7-Bit ASCII
    • US-ASCII, GB1988
  • :binary Arbitrary string
    • ASCII-8BIT

Other encodings are currently not supported.

Properties

General

valid?

Validness is determined by Ruby's String#valid_encoding?

unicode?

true for Unicode encodings (UTF-X)

control?

Control characters are codepoints in the is C0, delete or C1 control character range. Characters in this range of IBM codepage 437 based encodings are always treated as control characters.

assigned?

  • All valid ASCII and BINARY characters are considered assigned
  • For other byte based encodings, a character is considered assigned if it is not on the exception list included in this library. C0 control characters (and \x7F) are always considered assigned. C1 control characters are treated as assigned, if the encoding generally does not assign characters in the C1 region.
  • For Unicode, the general category is considered

blank?

The library includes a list of characters that might not be rendered visually. This list does not include unassigned codepoints, control characters (except for \t, \n, \v, \f, \r, and \u{85} in Unicode), or special formatting characters (right-to-left markers, variation selectors, etc).

separator?

Returns true if character is considered a separator. All separators also return true for the blank? check. In Unicode, the following characters are separators: \n, \v, \f, \r, \u{85} (next line), \u{2028} (line separator), and \u{2029} (paragraph separator)

format?

This flag is true only for special formatting characters, which are not control characters, like right-to-left marks. In Unicode, this means codepoints with the General Category of Cf.

Additional Unicode Properties

variation_selector?

true for variation selectors.

tag?

true for tags.

ignorable?

true for characters which might not be implemented, and thus, might render no visible glyph.

noncharacter?

true if codepoint will never be assigned in a future standard of Unicode.

Todo

  • Support all non-dummy encodings that Ruby supports

Also See

MIT License

Copyright (C) 2017-2022 Jan Lelis https://janlelis.com. Released under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].