Skip to content

ANSI Code Page in Hyper-V Windows containers should not be 65001 #579

@neberson

Description

@neberson

Description
When running a Windows container with Hyper-V isolation, the system ANSI Code Page (ACP) is set to 65001, which corresponds to the UTF-8 code page, rather than to an "ordinary" code page.

For Windows Desktop, this is a Beta feature called "Beta: Use Unicode UTF-8 for worldwide language support":

Image

As this causes incompatibilities with software that doesn't support UTF-8, it should not be enabled in containers by default.

Most notoriously, this happens with SQL Server: microsoft/mssql-docker#466 (comment)
But it also affects other software: https://social.msdn.microsoft.com/Forums/en-US/0c4a2452-efd5-4e39-bd58-9748201e1670/codepages-in-servercorenanoserver?forum=windowscontainers
Another example: conda/conda#8088
Repro steps without SQL Server:

Execute docker run -it --rm --isolation=hyperv mcr.microsoft.com/windows/servercore:1903 powershell
Inside the PowerShell, run this:
$Signature = "[DllImport("kernel32.dll")] public static extern int GetACP();";$acpGetter = Add-Type -MemberDefinition $Signature -Name "Acp" -Namespace Win32Functions -PassThru; $acpGetter::GetACP()
Observe the results
Describe the results you received:

With process isolation: 1252 (an "ordinary" code page)
With Hyper-V isolation: 65001 (the UTF-8 code page)
Describe the results you expected:
The selected code page shouldn't be determined by a beta feature that's not enabled on the host, regardless of the isolation mode. So it should either

be the same as on the host OS (in my case, 1252),
be hardcoded to something more friendly to non-UTF-8 applications,
or be configurable at container start.
Output of docker version:

Client: Docker Engine - Community
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:22:37 2019
OS/Arch: windows/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.24)
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:36:50 2019
OS/Arch: windows/amd64
Experimental: false
Output of docker info:

Client:
Debug Mode: false

Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 7
Server Version: 19.03.5
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics internal l2bridge l2tunnel nat null overlay private transparent
Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 18362 (18362.1.amd64fre.19h1_release.190318-1202)
Operating System: Windows 10 Pro Version 1903 (OS Build 18362.592)
OSType: windows
Architecture: x86_64
CPUs: 12
Total Memory: 31.85GiB
Name: W1119
ID: 6SEL:LRZQ:3NZL:TEA3:KE36:A6UU:Y4WU:EXDA:PRKO:QSZQ:QQA3:V4WU
Docker Root Dir: D:\DockerData
Debug Mode: true
File Descriptors: -1
Goroutines: 28
System Time: 2020-02-17T15:21:58.5160558+01:00
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions