generated from marco/cpp-template
Convert Unicode codepoints (hex) to UTF-8 byte sequences
- C++ 100%
|
|
||
|---|---|---|
| src | ||
| .gitattributes | ||
| .gitignore | ||
| cmake.toml | ||
| CMakeLists.txt | ||
| cmkr.cmake | ||
| compile_commands.json | ||
| README.md | ||
Icocon
A simple fontawesome icons into UTF8 bytes
Conversion logic (manual, for reference)
Example: F7C2
Split into hex digits: F, 7, C, 2
Convert each to 4-bit binary (anchors: A-F = 10-15 = 1010-1111):
F = 1111 7 = 0111 C = 1100 2 = 0010
Glue together into one 16-bit string: 1111011111000010 Split into 4/6/6 chunks: 1111-011111-000010
Prepend UTF-8 prefixes for a 3-byte sequence: 1110 + chunk1 → 1110 1111 10 + chunk2 → 10 011111 10 + chunk3 → 10 000010
Convert each 8-bit byte to hex: 11101111 = EF 10011111 = 9F 10000010 = 82
Result: \xef\x9f\x82