wcswidth
int wcswidth(const wchar_t *, size_t);
if ((width = wcswidth(buf, len)) <= 2)
width = wcswidth(buf, len);