Standard library / encoding/json
encoding/json.InvalidUTF8Error.Error()
Return the diagnostic for the historical invalid UTF-8 error type. Deprecated: modern Marshal replaces invalid UTF-8 rather than returning this error. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (e *InvalidUTF8Error) Error() stringReturn Value
string
Text representation or diagnostic.
Working Example
Example Snippetgo
package main
import ( "encoding/json" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { e := &json.InvalidUTF8Error{S: "bad"}; fmt.Println(len(e.Error()) > 0) }