I've been trying to code a UTF-16 string structure, and although the standard library provides a unicode module, it doesn't seem to provide a way to print out a slice of u16.
I've tried this:
const std = @import("std");
const unicode = std.unicode;
const stdout = std.io.getStdOut().outStream();
pub fn main() !void {
const unicode_str = unicode.utf8ToUtf16LeStringLiteral(" hello! ");
try stdout.print("{}\n", .{unicode_str});
}
This outputs:
[12:0]u16@202e9c
Is there a way to print a unicode string ([]u16) without converting it back into a non-unicode string ([]u8)?