Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
utf8 byte sequence validator
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
tests
.travis.yml
Makefile
README.markdown

README.markdown

utf8v

This is a basic UTF-8 byte sequence validator in C.

Build Status

How to Use it

First step:

#include <utf8v.h>

You can use the main function (signature below):

int utf8v_validate(uint8_t* data, int size);

Return codes description:

  • -1 - wrong size information
  • 1 - invalid byte sequences
  • 0 - sequence is valid.

If you need, there is also the functions used to make utv8v_validate work:

int
    valid_first_range(uint8_t byte);

int
    valid_second_range(uint8_t byte, uint8_t second);

int
    valid_third_range(uint8_t byte, uint8_t second, uint8_t third);

int
    valid_fourth_range(uint8_t byte,
                       uint8_t second,
                       uint8_t third,
                       uint8_t fourth);
int
    extract_sequence_length(uint8_t first_byte);

Tests

Run:

make test

Coverage Report

In order to run coverage reports you'll have to install "lcov" package.

make coverage

Then, open coverage/index.html

Contact

felipecruz@loogica.net

Something went wrong with that request. Please try again.