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

Windows for business | Windows Client for IT Pros | Storage high availability | Virtualization and Hyper-V

Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Oldest
  1. Mico Mi 1,941 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.

    Was this answer helpful?

    0 comments No comments
  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more