add unicode error handling to core text

Fixes #2684