Files
ParadoxSaveParser/ParadoxSaveParser.Lib/ParadoxEncodings.cs
T
2026-09-15 13:18:09 +02:00

20 lines
713 B
C#

namespace ParadoxSaveParser.Lib;
/// <summary>
/// Encodings used by Paradox save files.
/// Touching this class registers the code page provider, so no consumer has to do it.
/// </summary>
public static class ParadoxEncodings
{
/// <summary>Encoding of EU4 save files.</summary>
public static Encoding Windows1252 { get; }
static ParadoxEncodings()
{
// .NET ships only ASCII, Latin1 and the Unicode encodings; code pages come from this provider
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
// assigned here and not in an initializer, which would run before the provider is registered
Windows1252 = Encoding.GetEncoding(1252);
}
}