# std.unicode: Refactor and add WTF-16/WTF-8 functions · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/4ee1309a8d261360c5b80a9533535231b60780f5)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 4ee1309a8d261360c5b80a9533535231b60780f5

Requested commit: 4ee1309a8d261360c5b80a9533535231b60780f5

Commit: 4ee1309a8d261360c5b80a9533535231b60780f5

Tree: 5d278233be6e57e07631ce02d5d93cd95be636fe

Author: Ryan Liptak

Committer: Ryan Liptak

## Message

```
std.unicode: Refactor and add WTF-16/WTF-8 functions

Renamed functions for consistent `Le` capitalization and conventions:

- utf16leToUtf8Alloc -> utf16LeToUtf8Alloc
- utf16leToUtf8AllocZ -> utf16LeToUtf8AllocZ
- utf16leToUtf8 -> utf16LeToUtf8
- utf8ToUtf16LeWithNull -> utf8ToUtf16LeAllocZ
- fmtUtf16le -> fmtUtf16Le

New UTF related functions:

- utf16LeToUtf8ArrayList
- utf8ToUtf16LeArrayList
- utf8ToUtf16LeAlloc
- isSurrogateCodepoint

(the ArrayList functions are mostly to allow the Alloc and AllocZ to share an implementation)

New WTF related functions/structs:

- wtf8Encode
- wtf8Decode
- wtf8ValidateSlice
- Wtf8View
- Wtf8Iterator
- wtf16LeToWtf8ArrayList
- wtf16LeToWtf8Alloc
- wtf16LeToWtf8AllocZ
- wtf16LeToWtf8
- wtf8ToWtf16LeArrayList
- wtf8ToWtf16LeAlloc
- wtf8ToWtf16LeAllocZ
- wtf8ToWtf16Le
- wtf8ToUtf8Lossy
- wtf8ToUtf8LossyAlloc
- wtf8ToUtf8LossyAllocZ
- Wtf16LeIterator

```

## Parents

- [b344ff01d380d85256929b6be2428d3c022a8580](https://git.cafe/gitcafe/zig/commit/b344ff01d380d85256929b6be2428d3c022a8580?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/4ee1309a8d261360c5b80a9533535231b60780f5?format=markdown)
