Minimal UTF-8 support in C code

caminhante 0bdf30cfaa Create new branch named "v1.0" 4 jaren geleden
LICENSE 8513670368 Commit inicial 4 jaren geleden
Makefile 8db7c4ef88 A Makefile, more information at README 4 jaren geleden
README.md f7f91c2831 README now mentioning monotonic versioning 4 jaren geleden
minimal_UTF8.leo 8db7c4ef88 A Makefile, more information at README 4 jaren geleden
utf8.c 8513670368 Commit inicial 4 jaren geleden
utf8.h 8513670368 Commit inicial 4 jaren geleden

README.md

Minimal UTF-8 support

Public-domain library with small set of functions to manipulate UTF-8 encoded text.

Features

  • Test whether a sequence of bytes is a valid UTF-8 character
  • Represent UTF-8 characters as a struct vector
  • Convert from an UTF-8 character to a 32-bit Unicode Codepoint
  • Convert from a 32-bit Unicode Codepoint to an UTF-8 character
  • Function to calculate the required space to convert a C string into an UTF-8 vector
  • Function to calculate the required space to convert an UTF-8 vector into a C string
  • Convert from a C string to an UTF-8 vector
  • Convert from an UTF-8 vector to a C string
  • Function to advance reading one UTF-8 character at a time
  • Function to send an UTF-8 character to file descriptor
  • Function to send an UTF-8 vector to file descriptor
  • Function to search an UTF-8 character in a vector
  • Function to search a sequence of characters in a vector

Goals and priorities

  • Be helpful
  • Be correct
  • Facilitate text manipulation

Non-goals

  • Implement large functions

Installation

For using this library at your project, you can:

  • add utf8.[ch] files directly into your project (this library is public domain software);
  • load libminiutf8.so dynamically at runtime;
  • compile libminiutf8.a or utf8.o into your native executables.

Code examples

Coming soon.

Using, editing and notes

Each function has a descriptive commentary in the file utf8.h.

I use Leo Editor as my IDE.

This software is versioned under the monotonic versioning method. For more information see The Monotonic Versioning Manifesto