-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorerror messageThis issue points out an error message that is unhelpful and should be improved.This issue points out an error message that is unhelpful and should be improved.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Zig Version
0.11.0
Steps to Reproduce and Observed Behavior
When using some UTF-8 characters to pad/fill the output, print() fails. In the example below, while padding with + signs works as expected, padding with ─ does not. The character ─ is a box drawing character, useful e.g. when drawing tables with text in the terminal.
const std = @import("std");
pub fn main() !void {
// std.debug.print("{?s:+^20}\n", .{"test"}); // WORKS
// Output: ++++++++test++++++++
std.debug.print("{?s:─^20}\n", .{"test"}); // DOES NOT WORK
}❯ zig run main.zig
/nix/store/2rnf5zzshg65zw7g82bph1i1dph2z2r6-zig-0.11.0/lib/zig/std/fmt.zig:268:17: error: expected . or }, found '�
@compileError("expected . or }, found '" ++ [1]u8{ch} ++ "'");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/2rnf5zzshg65zw7g82bph1i1dph2z2r6-zig-0.11.0/lib/zig/std/fmt.zig:151:55: note: called from here
const placeholder = comptime Placeholder.parse(fmt[fmt_begin..fmt_end].*);
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Expected Behavior
For the padding to work with any printable character.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorerror messageThis issue points out an error message that is unhelpful and should be improved.This issue points out an error message that is unhelpful and should be improved.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.