EscapeString escapes JSON string contents. It does not add quotes around it. It returns ErrInvalidUTF8 if s contains invalid UTF-8. That is the only possible error.
(s string)
| 14 | // It returns ErrInvalidUTF8 if s contains invalid UTF-8. |
| 15 | // That is the only possible error. |
| 16 | func EscapeString(s string) (string, error) { |
| 17 | b, err := AppendString(nil, s) |
| 18 | return string(b), err |
| 19 | } |
| 20 | |
| 21 | // The following code is extracted from https://github.com/go-json-experiment/json |
| 22 | // at commit 3fecd76f5acdb9037c6c96eb6b869c69293f9c21 (Nov 7, 2022). |
nothing calls this directly
no test coverage detected