Fall back to repr if utf-8 encoding fails