Skip to content

native-image compile doesn't restore original Windows terminal code page #3979

@philwalk

Description

@philwalk

Version(s)

scala-cli version

Scala CLI version: 1.10.2-SNAPSHOT
Scala version (default): 3.7.4

Describe the bug
A native-image compile changes the code page to 437 (as expected) but doesn't cleanup afterwards, leaving the terminal misconfigured for utf8.

To Reproduce
Showing the Windows code page required for UTF encoding:

# chcp.com Active code page: 65001 

GraalVM compile overrides the code page:

# scala-cli --power package -f --native-image jsrc/sysprops.sc -- --no-fallback Compiling project (Scala 3.7.4, JVM (17)) Compiled project (Scala 3.7.4, JVM (17)) C:\opt\ue>chcp 437 Active code page: 437 ********************************************************************** ** Visual Studio 2022 Developer Command Prompt v17.14.9 ** Copyright (c) 2025 Microsoft Corporation ********************************************************************** [vcvarsall.bat] Environment initialized for: 'x64' [...] 

Showing the residual code page after compiling:

# chcp.com Active code page: 437 

This prevents correct display of UTF-8 "ballot box with check":

# scala -e 'printf("%s\n", "\u2611")' Compiling project (Scala 3.7.2, JVM (17)) Compiled project (Scala 3.7.2, JVM (17)) ? 

Restoring the code page to 65001 fixes the problem:

# chcp.com 65001 Active code page: 65001 # scala -e 'printf("%s\n", "\u2611")' Compiling project (Scala 3.7.2, JVM (17)) Compiled project (Scala 3.7.2, JVM (17)) ☑ 

Expected behaviour
The first step of a GraalVM compile is to set the code page to 437 (as required by Visual Studio). After the compile (whether successful or not) it should restore the code page to the original setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDev experiencebugSomething isn't workingwindowsWindows-specific issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions