Tab replacement code didn't calculate token length with the proper encoding.