How can I change default codepage (What GetACP() returns) on a Windows Container running in Hyper-V VM

Adam Skwersky 1 Reputation point
2020-12-19T00:09:52.297+00:00

We are using Windows docker containers on a Windows host to help increase our testing bandwidth. We are using Hyper-V VM because each test may need to be isolated.
Our tests expect the GetACP() to return 1252, but in the containers, GetACP() always returns 65001.
As such the output does not match our expected output and the tests fail.
Is there a way we can edit the registry so that processes are run with GetACP() returning 1252?
Thanks
Adam Skwersky

Hyper-V
Hyper-V
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
2,560 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mico Mi 1,921 Reputation points
    2020-12-21T06:57:17.89+00:00

    Hi,
    GetACP() returns a value which indicates what your current codepage is. For the UTF-8 codepage, this returns 65001, if the system's locale is set to English United Kingdom (for example), GetACP will return 1252.
    Maybe you can try to change the system’s locale and rebooting and check if it works.
    Here are some docs about how to change the system’s locale and the Code Page Identifiers for Windows ANSI:
    https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-international-core-winpe-systemlocale
    https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers

    Thanks for your time!
    Best Regards,
    Mico Mi

    -----------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments