- prior test encoders were never invoked for `null` or empty `string`s e.g.
``` c#
public static void HtmlEncode(this IHtmlEncoder htmlEncoder, string value, TextWriter output)
{
...
if (!String.IsNullOrEmpty(value))
{
htmlEncoder.HtmlEncode(value, 0, value.Length, output);
}
}
```
- add missing `null` checks and handle `string.Empty` in `TextWriter output, string value, ...` overloads
- better match for the underlying `TextEncoder` behaviour
- `EncoderExtensions` provided an API like `TextEncoder.Encode(TextWriter output, string value)`
- that method calls `Encode(TextWriter output, string value, int startIndex, int characterCount)`
- aspnet/Mvc#3138 part 1/2
- check parameters with same polarity as type and subtype
- ignore quality factors
- bug was obscured because MVC has no formatters supporting wildcard media types
nits:
- add doc comments
- spelling
- correct typo in a `project.json` file
Resolves a bunch of duplication between TagHelperContent and
BufferedHtmlContent, plus adds a few more convenience overloads we don't
have in one of the two places.
This is needed because a builder may have an optimized path for an
unencoded string. There's also no 'common' encoded string implementation
so it's much more straightforward to put this on the interface.
Common interface for things that allow appending content (TagBuilder,
BufferedHtmlContent). We want to be able to expose this from APIs for
users to add content.
See discussion: https://github.com/aspnet/Mvc/issues/3087
- Add public struct enumerator (avoids enumerator allocations)
- Implement IReadOnlyList<string>
- Rename indexer parameter name from "key" to "index"
- Faster IndexOf (no more enumerator allocation & faster array enumeration)
- Faster Contains (no more box allocation)
- Faster CopyTo (no more enumerator allocation)
- Faster Concat (no more enumerator allocations; use CopyTo)