add unicode error handling to core text
Merge pull request #2696 from kived/text-unicodeerror

add unicode error handling to core text