Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions PCL.Core/Utils/OS/KernelInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ private struct MEMORYSTATUSEX

[LibraryImport("kernel32.dll", EntryPoint = "GetConsoleWindow")]
private static partial nint _GetConsoleWindow();

[LibraryImport("kernel32.dll")]
internal static partial uint GetACP();

// ReSharper restore InconsistentNaming, UnusedMember.Local

Expand Down
3 changes: 1 addition & 2 deletions PCL.Core/Utils/OS/SystemInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Runtime.InteropServices;
using System.Text;

namespace PCL.Core.Utils.OS;

Expand All @@ -19,7 +18,7 @@ public static class SystemInfo
/// <summary>
/// 是否使用 GBK 编码。
/// </summary>
public static readonly bool IsGBKEncoding = Encoding.Default.CodePage == 936;
public static readonly bool IsGBKEncoding = KernelInterop.GetACP() == 936;

/// <summary>
/// 系统信息描述,例如 Microsoft Windows 11 专业工作站版 10.0.22635.0
Expand Down