# std.json: Fix decoding of UTF-16 surrogate pairs \(\#16830\) · gitcafe/zig

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

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

Visibility: public

Requested revision: a155e35850def120af90993e1b4309b80b97eb85

Requested commit: a155e35850def120af90993e1b4309b80b97eb85

Commit: a155e35850def120af90993e1b4309b80b97eb85

Tree: d886aa1293c40d8565fae63a168a5c59755d0b17

Author: Ryan Liptak

Committer: GitHub

## Message

```
std.json: Fix decoding of UTF-16 surrogate pairs (#16830)

* std.unicode: Add more UTF-16 decoding functions

This mostly makes parts of Utf16LeIterator reusable

* std.json: Fix decoding of UTF-16 surrogate pairs

Before this commit, there were 524,288 codepoints that would get decoded improperly. After this commit, there are 0.

Fixes #16828
```

## Parents

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

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