Unicode helper and search utility
Project description
ucnum argument...
The ucnum program is a command line utility which allows you to convert decimal, octal, hexadecimal, and binary numbers; Unicode character and block names; and HTML/XHTML character entity names and numbers into one another. It can be used as an on-line special character reference for Web authors.
This version is a (blind) reimplementation of the original unum Perl utility by Gisle Aas (https://www.fourmilab.ch/webtools/unum/) in Python. It was written because it will stay up-to-date via Python’s own unicodedata updates. It has a few minor discrepancies:
1. The octal syntax 077 is not accepted: Use 0o77 instead.
2. Character information tables also contain the unicode block.
3. The regular expression flavour is Python’s.
4. The HTML escapes argument form is not accepted yet (see “TODO”).
5. Name aliases (e.g. for control characters) are not supported yet.
Arguments
=========
The command line may contain any number of the following forms of I<argument>:
123
Decimal number.
0o371
Octal number preceded by “0o”.
0x1D351
Hexadecimal number preceded by “0x”. Letters may be upper or
lower case, but the “x” must be lower case.
0b110101
Binary number.
b=block
Unicode character blocks matching block are listed.
The block specification may be a regular expression.
For example, “b=greek” lists all Greek character blocks
in Unicode.
c=char...
The Unicode character codes for the characters “char...” are printed.
If the first character is not a decimal digit and the second not an
equal sign, the “c=” may be omitted.
h=entity
List all HTML/XHTML character entities matching entity, which may
be a regular expression. Matching is case-insensitive, so
“h=alpha” finds both “Α” and “α”.
l=block
List all Unicode blocks matching block and all characters
within each block; “l=goth” lists the Gothic block
and the 32 characters it contains.
n=name
List all Unicode character whose names match name, which may be
a regular expression. For example, “n=telephone” finds the five
Unicode characters for telephone symbols.
TODO
====
The following argument form is not yet accepted:
'&#number;&#xhexnum;...'
List the characters corresponding to the specified HTML/XHTML
character entities, which may be given in either decimal or
hexadecimal. Note that the “x” in XHTML entities must be lower case.
On most Unix-like operating systems, you'll need to quote the argument
so the ampersand, octothorpe, and semicolon aren't interpreted by the
shell.
Output
======
For number or character arguments, the value(s) are listed in all of the input formats, save binary.
Octal Decimal Hex HTML Character Block Unicode
0o46 38 0x26 & & Basic Latin AMPERSAND
If the terminal font cannot display the character being listed, the “Character” field will contain whatever default is shown in such circumstances. Control characters are shown as a Python hexadecimal escape.
Unicode blocks are listed as follows:
Start End Unicode Block
0x2460 - 0x24ff Enclosed Alphanumerics
0x1d400 - 0x1d7ff Mathematical Alphanumeric Symbols
0x1f100 - 0x1f1ff Enclosed Alphanumeric Supplement
The ucnum program is a command line utility which allows you to convert decimal, octal, hexadecimal, and binary numbers; Unicode character and block names; and HTML/XHTML character entity names and numbers into one another. It can be used as an on-line special character reference for Web authors.
This version is a (blind) reimplementation of the original unum Perl utility by Gisle Aas (https://www.fourmilab.ch/webtools/unum/) in Python. It was written because it will stay up-to-date via Python’s own unicodedata updates. It has a few minor discrepancies:
1. The octal syntax 077 is not accepted: Use 0o77 instead.
2. Character information tables also contain the unicode block.
3. The regular expression flavour is Python’s.
4. The HTML escapes argument form is not accepted yet (see “TODO”).
5. Name aliases (e.g. for control characters) are not supported yet.
Arguments
=========
The command line may contain any number of the following forms of I<argument>:
123
Decimal number.
0o371
Octal number preceded by “0o”.
0x1D351
Hexadecimal number preceded by “0x”. Letters may be upper or
lower case, but the “x” must be lower case.
0b110101
Binary number.
b=block
Unicode character blocks matching block are listed.
The block specification may be a regular expression.
For example, “b=greek” lists all Greek character blocks
in Unicode.
c=char...
The Unicode character codes for the characters “char...” are printed.
If the first character is not a decimal digit and the second not an
equal sign, the “c=” may be omitted.
h=entity
List all HTML/XHTML character entities matching entity, which may
be a regular expression. Matching is case-insensitive, so
“h=alpha” finds both “Α” and “α”.
l=block
List all Unicode blocks matching block and all characters
within each block; “l=goth” lists the Gothic block
and the 32 characters it contains.
n=name
List all Unicode character whose names match name, which may be
a regular expression. For example, “n=telephone” finds the five
Unicode characters for telephone symbols.
TODO
====
The following argument form is not yet accepted:
'&#number;&#xhexnum;...'
List the characters corresponding to the specified HTML/XHTML
character entities, which may be given in either decimal or
hexadecimal. Note that the “x” in XHTML entities must be lower case.
On most Unix-like operating systems, you'll need to quote the argument
so the ampersand, octothorpe, and semicolon aren't interpreted by the
shell.
Output
======
For number or character arguments, the value(s) are listed in all of the input formats, save binary.
Octal Decimal Hex HTML Character Block Unicode
0o46 38 0x26 & & Basic Latin AMPERSAND
If the terminal font cannot display the character being listed, the “Character” field will contain whatever default is shown in such circumstances. Control characters are shown as a Python hexadecimal escape.
Unicode blocks are listed as follows:
Start End Unicode Block
0x2460 - 0x24ff Enclosed Alphanumerics
0x1d400 - 0x1d7ff Mathematical Alphanumeric Symbols
0x1f100 - 0x1f1ff Enclosed Alphanumeric Supplement
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
ucnum-1.1.tar.gz
(3.9 kB
view details)
ucnum-1.0.tar.gz
(4.1 kB
view details)
File details
Details for the file ucnum-1.1.tar.gz
.
File metadata
- Download URL: ucnum-1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9e251ddc1ec93ee9219b9d45894551bae7fb5cdbfcf0b098fd4da629dab5a4b |
|
MD5 | d67f0e2e203e39df140f70cb2046193d |
|
BLAKE2b-256 | be73159b12e7c1dc4617b6b60ce9792dd62dc4115e94b2af16fa98e6a77bb637 |
File details
Details for the file ucnum-1.0.tar.gz
.
File metadata
- Download URL: ucnum-1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f0d16d64103dd7bc5ce418162532812aa6e95c1835d2af8a4134524a45c7508 |
|
MD5 | ebbd0b58ba63a0bfd0143c0de74c4b9b |
|
BLAKE2b-256 | 0ef9a63fe4a89c31202c364f2ca4344695c2946609d874e4cea0bab0597ed8e1 |