fix #7248: throw boundserror for invalid indices in ind2chr/chr2ind