Remove invalid UTF-8 characters from a string
问题 I get this on json.Marshal of a list of strings: json: invalid UTF-8 in string: "...ole\xc5\" The reason is obvious, but how can I delete/replace such strings in Go? I've been reading docst on unicode and unicode/utf8 packages and there seems no obvious/quick way to do it. In Python for example you have methods for it where the invalid characters can be deleted, replaced by a specified character or strict setting which raises exception on invalid chars. How can I do equivalent thing in Go?