[ACCEPTED]-context.Response.Charset = Encoding.UTF8.ToString();-character-encoding

Accepted answer
Score: 27
Context.Response.Charset = Encoding.UTF8.WebName;

Gets the name registered with the Internet 2 Assigned Numbers Authority (IANA) for the 1 current encoding.

Score: 5
Encoding.UTF8.ToString();

doesn't return

"utf-8"

It returns

"System.Text.UTF8Encoding"

which is the name 5 of the type that Encoding.UTF8 lives in.

The 4 name of the type (or class definition) is 3 always returned by Object.ToString() if 2 there is no overriding method in the class 1 (which is the case here).

Score: 1

use Encoding.UTF8.WebName to get the value 1 to be used in the charset.

More Related questions