Better handling of strings that failed encoding.