current position:Home>C + + getline cannot correctly read the console input Chinese

C + + getline cannot correctly read the console input Chinese

2022-02-02 17:01:56 CSDN Q & A

getline(cin,str) After entering Chinese on the console , Use immediately cout There will be garbled code in printing , operating system win10, Area selection required utf-8, The code page in the console properties is also utf-8, Why? ?




Refer to the answer 1:

getline(wcin,wstring)
wcout




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021701552410.html

Random recommended