BassLC / idUTF8lib

Idiot's UTF-8 Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Idiot's UTF-8 Library

A very (too much really) simple Utf8 library for C++

Usage

#include "lib/idutf8lib.hpp"

Utf8String text; //Empty UTF8 object
Utf8String utf8_text("Héĺĺò Ẃórld"); //std::string compatible constructor
text = "Jello!"; //Supports assignment with std::string AND Utf8String objects
text.to_string(); // == std::string("Jello!")

utf8_text.size_in_chars(); // == 11
utf8_text.size_in_bytes(); // == 18 

utf8_text[0]; // == std::string("H")
utf8_text.sub_utf8str(1,3); // == Utf8String("éĺĺ")

Features

  • Decodes and parses UTF-8 strings correctly (at least until now)
  • Very lightweight and small: less than 200 newlines total (*without counting tests)

Requirements

  • A C++14 compatible compiler

Notes

Makefile serves only for testing purposes.

Uses the Catch framework for tests.

Thanks

UTF8-CPP

tiny-utf8

About

Idiot's UTF-8 Library

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 100.0%Language:Makefile 0.0%