TextOutputFormatter.SelectCharacterEncoding Method

Definition

Determines the best Encoding amongst the supported encodings for reading or writing an HTTP entity body based on the provided content type.

C#
public virtual System.Text.Encoding SelectCharacterEncoding (Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterWriteContext context);

Parameters

context
OutputFormatterWriteContext

The formatter context associated with the call.

Returns

The Encoding to use when reading the request or writing the response.

Applies to

Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0