Fixes #6227 skip non-unicode strings and catch decode errors silently in template_from_string