Skip to content

Commit

Permalink
Update README to reflect new function
Browse files Browse the repository at this point in the history
  • Loading branch information
penguin-teal committed Dec 18, 2023
1 parent 95058a8 commit c3b9b83
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# utf8encoder
Two simple functions to encode and decode UTF-8 from/to its Unicode code
points using bitwise operators.
points using bitwise operators. A third function to get the size of a
UTF-8 character from its first byte.

The Makefile is for Linux, however the code itself should compile on any
platform.
Expand All @@ -11,27 +12,6 @@ platform.

The header file is in `./include/utf8encoder.h`.

```c
/**
* Encodes a single UTF-8 code point into its binary representation.
* Fills the `size` argument with the size.
* `size` will be set to `0` on fail.
* @param codePoint The code point (e.g. the 0xAE49 in U+AE49).
* @param size Where to copy the number of bytes the encoded code
* point uses, or `NULL`.
* @return The encoded binary, ranging from using 1 to all 4 bytes.
*/
uint32_t utf8Encode(uint64_t codePoint, size_t *size);

/**
* Decodes a single UTF-8 encoded character into its code point.
* An error occurred if `binary` was not `0` and this function returns `0`.
* @param binary The UTF-8 encoded byte character.
* @return The code point of the UTF-8 encoded character.
*/
uint64_t utf8Decode(uint32_t binary);
```
## Building

Build the shared object:
Expand Down

0 comments on commit c3b9b83

Please sign in to comment.