Пример #1
0
        private static JsonEncodedText EncodeHelper(ReadOnlySpan <byte> utf8Value, JavaScriptEncoder?encoder)
        {
            int idx = JsonWriterHelper.NeedsEscaping(utf8Value, encoder);

            if (idx != -1)
            {
                return(new JsonEncodedText(JsonHelpers.EscapeValue(utf8Value, idx, encoder)));
            }
            else
            {
                return(new JsonEncodedText(utf8Value.ToArray()));
            }
        }