From 3d7a431811748c5aa1f49c35436696fc3f05de5d Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 5 Feb 2021 14:10:53 +0100 Subject: Documentation, support validation via Traits --- debian/README.Debian | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'debian/README.Debian') diff --git a/debian/README.Debian b/debian/README.Debian index 162e3f0..382d20d 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -4,6 +4,81 @@ unicode for Debian This package is the Debian version of unicode, a C++ library for Unicode encoding. +CLI interface (package unicode-tools) +------------------------------------- + +* unicode-recode + + Usage: recode + Format: + UTF-8 UTF-8 + UTF-16 UTF-16, native endian + UTF-16LE UTF-16, little endian + UTF-16BE UTF-16, big endian + UTF-32 UTF-32, native endian + UTF-32LE UTF-32, little endian + UTF-32BE UTF-32, big endian + ISO-8859-1 ISO-8859-1 (Latin-1) + ISO-8859-15 ISO-8859-15 (Latin-9) + Exit code: 0 if valid, 1 otherwise. + +* unicode-validate + + Usage: validate + Format: + UTF-8 UTF-8 + UTF-16 UTF-16, big or little endian + UTF-16LE UTF-16, little endian + UTF-16BE UTF-16, big endian + UTF-32 UTF-32, big or little endian + UTF-32LE UTF-32, little endian + UTF-32BE UTF-32, big endian + Exit code: 0 if valid, 1 otherwise. + + +C++ interface (package libunicode-dev) +-------------------------------------- + +Example: + +#include +... + + std::string utf8_value {u8"äöü"}; + std::u16string utf16_value{unicode::convert(utf8_value)}; + +And for C++20: + + std::u8string utf8_value {u8"äöü"}; + std::u16string utf16_value{unicode::convert(utf8_value)}; + +The following encodings are implicitly deducted from types: + * char resp. char8_t (C++20): UTF-8 + * char16_t: UTF-16 + * char32_t: UTF-32 + +Explicit encoding specification is also possible: + + std::string value {"äöü"}; + std::u32string utf32_value{unicode::convert(value)}; + +Supported encodings are: + + * unicode::UTF_8 + * unicode::UTF_16 + * unicode::UTF_32 + * unicode::ISO_8859_1 + * unicode::ISO_8859_15 + +Validation can be done like this: + + bool valid{unicode::is_valid_utf(utf16_value)}; + +Or via explicit encoding specification: + + bool valid{unicode::is_valid_utf(utf8_value)}; + + Contact ------- -- cgit v1.2.3