All Projects → m13253 → libWinTF8

m13253 / libWinTF8

Licence: other
The library handling things related to UTF-8 and Unicode when you want to port your program to Windows

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
c
50402 projects - #5 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to libWinTF8

Voca rs
Voca_rs is the ultimate Rust string library inspired by Voca.js, string.py and Inflector, implemented as independent functions and on Foreign Types (String and str).
Stars: ✭ 167 (+827.78%)
Mutual labels:  unicode, utf-8
UniObfuscator
Java obfuscator that hides code in comment tags and Unicode garbage by making use of Java's Unicode escapes.
Stars: ✭ 40 (+122.22%)
Mutual labels:  unicode, utf-8
Stringz
💯 Super fast unicode-aware string manipulation Javascript library
Stars: ✭ 181 (+905.56%)
Mutual labels:  unicode, utf-8
Awesome Unicode
😂 👌 A curated list of delightful Unicode tidbits, packages and resources.
Stars: ✭ 693 (+3750%)
Mutual labels:  unicode, utf-8
simdutf8
SIMD-accelerated UTF-8 validation for Rust.
Stars: ✭ 426 (+2266.67%)
Mutual labels:  unicode, utf-8
Unicopy
Unicode command-line codepoint dumper
Stars: ✭ 16 (-11.11%)
Mutual labels:  unicode, utf-8
ocreval
Update of the ISRI Analytic Tools for OCR Evaluation with UTF-8 support
Stars: ✭ 48 (+166.67%)
Mutual labels:  unicode, utf-8
Bstr
A string type for Rust that is not required to be valid UTF-8.
Stars: ✭ 348 (+1833.33%)
Mutual labels:  unicode, utf-8
characteristics
Character info under different encodings
Stars: ✭ 25 (+38.89%)
Mutual labels:  unicode, utf-8
homoglyphs
Homoglyphs: get similar letters, convert to ASCII, detect possible languages and UTF-8 group.
Stars: ✭ 70 (+288.89%)
Mutual labels:  unicode, utf-8
Transliteration
UTF-8 to ASCII transliteration / slugify module for node.js, browser, Web Worker, React Native, Electron and CLI.
Stars: ✭ 444 (+2366.67%)
Mutual labels:  unicode, utf-8
Lingo
Text encoding for modern C++
Stars: ✭ 28 (+55.56%)
Mutual labels:  unicode, utf-8
Portable Utf8
🉑 Portable UTF-8 library - performance optimized (unicode) string functions for php.
Stars: ✭ 405 (+2150%)
Mutual labels:  unicode, utf-8
Unibits
Visualize different Unicode encodings in the terminal
Stars: ✭ 125 (+594.44%)
Mutual labels:  unicode, utf-8
Tomlplusplus
Header-only TOML config file parser and serializer for C++17 (and later!).
Stars: ✭ 403 (+2138.89%)
Mutual labels:  unicode, utf-8
jurl
Fast and simple URL parsing for Java, with UTF-8 and path resolving support
Stars: ✭ 84 (+366.67%)
Mutual labels:  unicode, utf-8
Tiny Utf8
Unicode (UTF-8) capable std::string
Stars: ✭ 322 (+1688.89%)
Mutual labels:  unicode, utf-8
Encoding.js
Convert or detect character encoding in JavaScript
Stars: ✭ 338 (+1777.78%)
Mutual labels:  unicode, utf-8
utf8-validator
UTF-8 Validator
Stars: ✭ 18 (+0%)
Mutual labels:  unicode, utf-8
UnicodeBOMInputStream
Doing things right, in the name of Sun / Oracle
Stars: ✭ 36 (+100%)
Mutual labels:  unicode, utf-8

libWinTF8

LibWinTF8 is the library handling things related to UTF-8 and Unicode when you want to port your program to Windows.

Compiling

You need a C++ 11 compliant compiler (GCC / Clang) or MSVC (at least version 12, that is Visual Studio 2013) and CMake to build this library.

On POSIX compatible systems with GCC toolchain, run ./configure && make to build it.

On Windows with MSVC toolchain, generate a Visual Studio solution from CMakeLists.txt and build it.

Considering the C++ ABI compatibility issue, it is recommended to use the same compiler to build libWinTF8 as well as other parts of your software.

Usage

Upon successful installation, you will be able to access all the functionality with C or C++ by including libwintf8.h

Every C++ function is under the WTF8 namespace.

Every C function is prefixed with WTF8_.

Demo

The following is a simple cat program, supporting UTF-8 filename and Unicode output.

#include <iostream>
#include <vector>
#include <libwintf8.h>

/* Set the Windows console font to Lucida Console, which is the only console font supporting Unicode characters. */
static WTF8::SetConsoleFont set_console_font;

int main() {
    /* WTF8::u8string inherits std::string. In addition to useful conversion methods, introducing a new type makes sure that different encodings do not mix up. */
    std::vector<WTF8::u8string> argv = WTF8::getargv();
    if(argv.size() < 2) {
        WTF8::cerr << "Usage: " << argv[0] << " filename" << std::endl;
        return 1;
    }

    /* WTF8::ifstream / ofstream / fstream accept WTF8::u8string as file name. */
    WTF8::u8string filename = argv[1];
    WTF8::ifstream fileobj(filename);
    if(!fileobj.is_open()) {
        WTF8::cerr << "Error: unable to open file '" << filename << "'" << std::endl;
        return 2;
    }

    /* WTF8::cin / cout / cerr / clog use UTF-8 text. */
    char c;
    while(fileobj.get(c))
        WTF8::cout << c;
    return 0;
}

Documentation

This project is in early development and the documentation is not finished yet. If you enjoy libWinTF8, consider helping me to document it.

Alternatively you can browse and read the source code to understand how it works.

License

This software is licensed under BSD license. Refer to the COPYING file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].