Fixed a bug where characters would cause text to be incorrectly truncated.