- C 96.2%
- Makefile 3.8%
| debian | Snapshot. | |
| .gitattributes | .gitattributes: file classification | |
| LICENSE.txt | Initial commit | |
| Makefile | Enable code analysis (leak checks etc.) when doing debug builds. | |
| README.md | Code scrapers are not welcome here. | |
| unicode.1 | Add code to output Unicode version info (for singleton characters). | |
| unicode.c | Recognise CJK ideograph blocks. | |
unicode - A basic unicode listing tool
Build
To build, make and a C compiler like GCC or Clang are needed. If PCRE2 is
available, it will be used – in Debian and similar distributions, you should
ensure that the package "libpcre2-dev" is installed.
sudo apt install libpcre2-dev # install PCRE2 (Debian-like)
make # default build, using PCRE2 if available
make WITH_PCRE=1 # build requiring PCRE2
make WITHOUT_PCRE=1 # build without PCRE2
Once installed, the UCD needs to be installed locally on your system. It's probably packaged – in Debian and similar distributions, you should install the package "unicode-data" if it's not already present:
sudo apt install unicode-data
Otherwise, you will need the UCD from this
directory.
Download UCD.zip (or UnicodeData.txt, which is all that this program
needs, and optionally DerivedAge.txt) and place the content
- in one of the standard directories (see below); or
- somewhere else, but don't forget you have to pass
-D /path/to/UnicodeData.txt(or just-D /path/to) for every invocation.
By default, unicode will look for UnicodeData.txt and DerivedAge.txt
in
/usr/local/share/unicode/usr/local/share/ucd/usr/share/unicode/usr/share/ucd
-D with a directory name causes unicode to look in that directory for
those files.
-D with a file name means that only the specified Unicode data file will
be used; no files will be looked for.
Note that it's strongly recommended that you place the UCD in the global directory if you plan to install globally, so everyone on the system can use it without any additional work.
Once this is done, test it by running ./unicode 20, and you should get:
U+0020: SPACE
Category: Separator, Space
Text direction: Whitespace
Defined in Unicode v1.1
The last line will only be present if DerivedAge.txt is looked for and
found.
If you get the message Unable to open default UCD file, that means that the unicode
directory is not placed in the correct path or that the file couldn't be
opened for some reason.
If you get the message Unable to open UCD file, you've used -D with the
wrong file name or something's wrong with the file; in either case, that
message will be followed by error text describing the failure.
Install
To install globally, you should run one of the following commands:
sudo make install # install in /usr/local/bin etc.
sudo make install PREFIX=/usr # install in /usr/bin etc.
(DESTDIR is available for use when making packages.)
To reverse the above, you should run the appropriate command from the following:
sudo make uninstall # remove from /usr/local/bin etc.
sudo make uninstall PREFIX=/usr # remove from /usr/bin etc.