commit: d930ae6691d9ae8dec71150e5cad0e200471bf13
parent 5019b9de8da65b86b607c85b929ccdba2488e1b3
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 17 Sep 2023 19:47:16 +0200
cmd/unicode: Make -n always prints as 4 characters minimum
Diffstat:
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/cmd/unicode.ha b/cmd/unicode.ha
@@ -84,11 +84,8 @@ fn decode(args: []str) void = {
for(let ri = 0z; ri < len(runes); ri += 1) {
const r = runes[ri]: u32;
- if(r > 0xFFFF) {
- fmt::printfln("{:08x}", r)!;
- } else {
- fmt::printfln("{:04x}", r)!;
- };
+ // Print as 4 characters min to match UnicodeData.txt formatting
+ fmt::printfln("{:04x}", r)!;
};
};
};
diff --git a/test-cmd/unicode.t b/test-cmd/unicode.t
@@ -30,3 +30,6 @@
03b5
03b9
03b1
+
+ $ ./cmd/unicode -n 𐀀
+ 10000