safeAddString JSON-escapes a string and appends it to the internal buffer. Unlike the standard library's encoder, it doesn't attempt to protect the user from browser vulnerabilities or JSONP-related problems.
(s string)
| 486 | // Unlike the standard library's encoder, it doesn't attempt to protect the |
| 487 | // user from browser vulnerabilities or JSONP-related problems. |
| 488 | func (enc *jsonEncoder) safeAddString(s string) { |
| 489 | safeAppendStringLike( |
| 490 | (*buffer.Buffer).AppendString, |
| 491 | utf8.DecodeRuneInString, |
| 492 | enc.buf, |
| 493 | s, |
| 494 | ) |
| 495 | } |
| 496 | |
| 497 | // safeAddByteString is no-alloc equivalent of safeAddString(string(s)) for s []byte. |
| 498 | func (enc *jsonEncoder) safeAddByteString(s []byte) { |