remove string casting from error formatting

Error formatting fails on unicode characters that can't be encoded in ascii