Fixed token encoding issue with StringBuilder