Width problem when using printf on chinese characters

A Chinese character will normally displays as 2 ascii width, but the format string in printf will treat it as 1 character. This may result in inconsistent string width with the same format string.

This is a simple example:

using Printf
@printf("%-10s: 111\n", "aaa")
@printf("%-10s: 111\n", "一")
1 Like

Should be fixed in Julia 1.7 Julia 1.8? https://github.com/JuliaLang/julia/pull/41085

With Julia 1.8-dev, I get:

julia> @printf("%-10s: 111\n", "一")
一        : 111

julia> @printf("%-10s: 111\n", "aaa")
aaa       : 111

(I thought this feature was merged for 1.7, but I guess it was merged right after the 1.7 feature freeze.)