Skip to content

Reading non-ASCII characters from the console on Windows doesn't work when codepage is 65001 #18701

@xenu

Description

@xenu

Description

Reading non-ASCII characters from the console on Windows doesn't work when codepage is 65001. It's caused by a bug in Windows: microsoft/terminal#4551

tl;dr: ReadFile() and ReadConsoleA() return zeros instead of non-ASCII characters when the console codepage is set to 65001. It's broken on all Windows versions, including the latest Windows 10 20H2.

This issue was discovered by a reddit user.

I'll submit a PR with a proposed workaround soon.

Steps to Reproduce

> chcp 65001
> perl -E "while(<>) { printf qq<%vd\n>, $_ }"
<input ąść and press enter>
0.0.0.10

Expected behavior

> chcp 65001
> perl -E "while(<>) { printf qq<%vd\n>, $_ }"
<input ąść and press enter>
196.133.197.155.196.135.10

Perl configuration

It's broken on all perl versions including blead.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions