mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
translate-c: Fix formatting of non-printable chars
The two octets in hex notation must be aligned to the right and padded on the left, not the other way around.
This commit is contained in:
parent
27adb82fda
commit
b7f9f779af
1 changed files with 1 additions and 1 deletions
|
|
@ -2032,7 +2032,7 @@ fn escapeChar(c: u8, char_buf: *[4]u8) []const u8 {
|
|||
// Handle the remaining escapes Zig doesn't support by turning them
|
||||
// into their respective hex representation
|
||||
else => if (std.ascii.isCntrl(c))
|
||||
std.fmt.bufPrint(char_buf, "\\x{x:0<2}", .{c}) catch unreachable
|
||||
std.fmt.bufPrint(char_buf, "\\x{x:0>2}", .{c}) catch unreachable
|
||||
else
|
||||
std.fmt.bufPrint(char_buf, "{c}", .{c}) catch unreachable,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue