wcwidthDetermine columns needed for a fixed-size wide-character string
'한'.length // => 1 wcwidth('한'); // => 2 '한글'.length // => 2 wcwidth('한글'); // => 4
wcwidth()and its string version,
wcswidth()are defined by IEEE Std 1002.1-2001, a.k.a. POSIX.1-2001, and return the number of columns used to represent the given wide character and string.
Further explaination here