从控制台输入的中文问题 #19897

Open
opened 2026-01-31 06:56:44 +00:00 by claunia · 0 comments
Owner

Originally created by @shiyou-t1c on GitHub (May 18, 2023).

Windows Terminal version

No response

Windows build number

10.0.22621.1555

Other Software

No response

Steps to reproduce

我在编写unicode程序时,硬编码用std::cout正常输出c风格字符串的"中文"到控制台,例如std::cout << "中文" << std::endl;
但无法通过std::cin输入中文到string里,例如string s1;std::cin >> s1;我想了解从控制台输入的中文到底是什么编码,以至于程序无法读取.

Expected Behavior

No response

Actual Behavior

从控制台输入的中文问题

Originally created by @shiyou-t1c on GitHub (May 18, 2023). ### Windows Terminal version _No response_ ### Windows build number 10.0.22621.1555 ### Other Software _No response_ ### Steps to reproduce **我在编写unicode程序时,硬编码用std::cout正常输出c风格字符串的"中文"到控制台,例如std::cout << "中文" << std::endl; 但无法通过std::cin输入中文到string里,例如string s1;std::cin >> s1;我想了解从控制台输入的中文到底是什么编码,以至于程序无法读取.** ### Expected Behavior _No response_ ### Actual Behavior 从控制台输入的中文问题
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 06:56:45 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19897