optimize column width calculation and utf-8 encode for ASCII