Handle multibyte strings better in TrimText. Fixes #214.