# translate-c: Add Wide, UTF-16, and UTF-32 character literals · gitcafe/zig

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

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

Visibility: public

Requested revision: c3dadfa95b01d140460eb3d3d47d13859302f298

Requested commit: c3dadfa95b01d140460eb3d3d47d13859302f298

Commit: c3dadfa95b01d140460eb3d3d47d13859302f298

Tree: 8d0135b3319b548b44e7f6ab1c9ba73d45a16788

Author: Evan Haas

Committer: Andrew Kelley

## Message

```
translate-c: Add Wide, UTF-16, and UTF-32 character literals

Add support for L'<wchar_t>', u'<char16_t>', and U'<char32_t>'. Currently
this just translates wide char literals to \u{NNNNNN} escape codes
(e.g. U'💯' -> '\u{1f4af}')

Another approach would be to emit UTF-8 encoded character literals
directly, but in my opinion this approaches Unicode-complete because it
would require knowledge of which Unicode codepoints have graphical
representations for the emitted source to be readable.

We could also just emit integer literals, but the current method makes
it clear that we have translated a wide character literal and not just
an integer constant.

```

## Parents

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

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