RepositoryCGBUnited Kingdom
sheredom

sheredom/utf8.h

📚 single header utf8 string functions for C and C++

2.0kstars
149forks
3issues
3views

Thành tựu nổi bật

Những danh hiệu mới nhất của dự án

1
TINIX TRENDING·Chủ đề: utf8

#1 Repository Của Tuần

1
TINIX TRENDING·Chủ đề: unicode

#1 Repository Của Tuần

5
TINIX TRENDING·Chủ đề: c

#5 Repository Của Tuần

📚 utf8.h – Thư viện UTF-8 đơn giản cho C và C++

Một giải pháp header-only nhẹ nhàng để hỗ trợ chuỗi UTF-8 trong C và C++, tuân thủ API của string.h.

utf8.h là một thư viện mã nguồn mở đơn tiệp (single header) cung cấp các hàm xử lý chuỗi UTF-8 cho ngôn ngữ C và C++. Dự án nhằm mang lại cách tiếp cận quen thuộc từ string.h nhưng hoạt động trên UTF-8 codepoint thay vì byte thuần. Hỗ trợ trên Linux, macOS và Windows với các trình biên dịch gcc, clang, MSVC cl.exe và clang-cl.exe.

✨ Điểm nổi bật

  • Tương tự string.h: Cung cấp các hàm như utf8cat, utf8chr, utf8cmp, utf8cpy... với tiền tố utf8 thay cho str.
  • Hỗ trợ C++14 constexpr: Nhiều hàm hỗ trợ constexpr cho phép tính toán thời gian biên dịch.
  • Xử lý codepoint: Các hàm trả về số lượng codepoint thay vì byte, ví dụ utf8len đếm codepoint.
  • Hàm độc quyền: Bao gồm utf8codepoint, utf8valid, utf8makevalid để kiểm tra và sửa chuỗi UTF-8.
  • Hỗ trợ C++20: Sử dụng char8_t* thay cho char* trong môi trường C++20.
  • Đa nền tảng: Hỗ trợ Windows, Linux, macOS với nhiều trình biên dịch phổ biến.

💡 Vì sao đáng chú ý

utf8.h không chỉ là bản sao của string.h mà còn tối ưu cho UTF-8 bằng cách thay đổi đơn vị xử lý từ byte sang codepoint. Điều này giúp các hàm như utf8len trả về độ dài chính xác theo ký tự Unicode thực sự. Thêm vào đó, việc hỗ trợ constexpr trong C++14 mở rộng khả năng sử dụng trong lập trình template và tính toán thời gian biên dịch. Phù hợp cho các dự án nhúng hoặc hệ thống yêu cầu xử lý UTF-8 nhẹ nhàng mà không cần thư viện nặng.


#UTF8 #C #Cpp #OpenSource #TiniX

Similar Projects

Discover other similar projects and AI models.

RepositoryC
lvgl/lvgl

LVGL is a free, full-featured embedded UI library for devices from small MCUs to 3D-capable MPUs, enhanced by LVGL Pro, a professional editor and tooling.

25.2k
Nov 20, 2026
Repository
fffaraz/awesome-cpp

A curated list of awesome C++ (or C) frameworks, libraries, resources, and shiny things. Inspired by awesome-... stuff.

74.6k
Nov 20, 2026
RepositoryC++
huihut/interview

📚 C/C++ 技术面试基础知识总结,包括语言、程序库、数据结构、算法、系统、网络、链接装载库等知识及面试经验、招聘、内推等信息。This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, including language, program library, data structure, algorithm, system, network, link loading library, interview experience, recruitment, recommendation, etc.

38.3k
Sep 17, 2026
Repository
forthespada/CS-Books

🔥🔥超过1000本的计算机经典书籍、个人笔记资料以及本人在各平台发表文章中所涉及的资源等。书籍资源包括C/C++、Java、Python、Go语言、数据结构与算法、操作系统、后端架构、计算机系统知识、数据库、计算机网络、设计模式、前端、汇编以及校招社招各种面经~

28.1k
Nov 15, 2026
RepositoryCMake
microsoft/vcpkg

C++ Library Manager for Windows, Linux, and MacOS

27.6k
Nov 18, 2026
RepositoryC++
RPCS3/rpcs3

PlayStation 3 emulator and debugger

20.5k
Nov 21, 2026
RepositoryC++
CoatiSoftware/Sourcetrail

Sourcetrail - free and open-source interactive source explorer

16.5k
Dec 13, 2021
RepositoryC++
simdutf/simdutf

Unicode routines (UTF8, UTF16, UTF32) and Base64: billions of characters per second using SSE2, AVX2, NEON, AVX-512, RISC-V Vector Extension, LoongArch64, POWER. Part of Node.js, WebKit/Safari, Ladybird, Chromium, Cloudflare Workers, Ghostty and Bun.

2.0k
Nov 15, 2026
RepositoryPHP
symfony/string

Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way

1.8k
Nov 4, 2026