using System; using System.Text; namespace Swan { /// /// Contains useful constants and definitions. /// public static partial class Definitions { /// /// The MS Windows codepage 1252 encoding used in some legacy scenarios /// such as default CSV text encoding from Excel. /// public static readonly Encoding Windows1252Encoding; /// /// The encoding associated with the default ANSI code page in the operating /// system's regional and language settings. /// public static readonly Encoding CurrentAnsiEncoding; /// /// Initializes the class. /// static Definitions() { CurrentAnsiEncoding = Encoding.GetEncoding(default(Int32)); try { Windows1252Encoding = Encoding.GetEncoding(1252); } catch { // ignore, the codepage is not available use default Windows1252Encoding = CurrentAnsiEncoding; } } } }