shorten bufname and handle multibyte chars correctly