Why does Encoding.ASCII != ASCIIEncoding.Default in C#?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
This is because ASCIIEncoding
derives from Encoding
, where Default
is defined as:
/// <summary>
/// Gets an encoding for the operating
/// system's current ANSI code page.
/// </summary>
public static System.Text.Encoding Default
{ get; }
So ASCIIEndcoding.Default
actually returns operating system’s default ANSI encoding.