Web Notes for Michael Wan

Just some notes in GitHub ...

Default legacy ANSI codepage (ACP) is always UTF-8(65001) under LTSC2019

Post Date: 2026-05-07

Default legacy ANSI codepage problem

Something weird about Windows container if the image is based on ltsc2019… While you are running it with --isolation=hyperv option, you will found that the default legacy ANSI codepage (ACP) is always UTF-8 (65001) no matter what you have going to change by using Set-WinSystemLocale, Set-Culture, chcp or even updating registry.

Here you can get the proof by running the LTSC2019 with HyperV isolation:

docker run -it --rm --isolation=hyperv mcr.microsoft.com/windows/servercore:ltsc2019 PowerShell

After started the powershell, checking the GetACP() return, it should be 65001:

Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class AcpHelper {
    [DllImport("kernel32.dll")]
    public static extern int GetACP();
}
"@

[AcpHelper]::GetACP()

#It should return 65001

Same result can be checked by below command as well (Both return default legacy ANSI codepage (ACP) and that is for legacy system):

[System.Text.Encoding]::Default.CodePage

#Should return 65001 as well

After spent some time to google and found that is Windows container issue and it has been fixed since LTSC2022. So below command should return 1251 instead of 65001:

docker run -it --rm --isolation=hyperv mcr.microsoft.com/windows/servercore:ltsc2022 PowerShell

#After powershell has been launch, try below command, it should return 1251
[System.Text.Encoding]::Default.CodePage

Additional Note

References: