Skip to content

Default WASI console encoding to UTF-8 - #137075

Merged
agocke merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:wasiconsole
Nov 6, 2026
Merged

agocke merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:wasiconsole

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

The WASI version of the .NET System.Console APIs currently supports more console code pages than the WASI libc. WASI libc will not pay attention to the charset suffix that this is parsing. 5.7% of Hello World size on native AOT WASI is rooted by this code. Maybe we don't need to support something that not even the WASI libc supports?

Use BOM-free UTF-8 for the initial console input and output encodings instead of interpreting locale charset suffixes. Preserve explicit encoding overrides and remove the unused Unix charset helper from the WASI build.

Reduces the invariant-globalization NativeAOT WASI Hello World from 808,084 to 762,001 bytes, saving 46,083 bytes (5.70%) with unchanged size settings. All previously linked UTF32Encoding functions are trimmed.

Validated 33 encoding checks on each of Release and Checked, including Unicode I/O and explicit UTF-16/UTF-32 overrides, plus Hello World across 11 locale environments.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9bc3dfee-1040-4648-bdad-86922a749613
@MichalStrehovsky MichalStrehovsky added arch-wasm WebAssembly architecture area-System.Console os-wasi Related to WASI variant of arch-wasm labels Nov 6, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-console
See info in area-owners.md if you want to be subscribed.

@agocke
agocke merged commit 0b25003 into dotnet:main Nov 6, 2026
113 checks passed
@MichalStrehovsky
MichalStrehovsky deleted the wasiconsole branch November 7, 2026 00:50
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-System.Console os-wasi Related to WASI variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants