Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't input Chinese characters when open a commandline program, with Windows Terminal as system's defualt Terminal emulator #13593

Closed
yixinBC opened this issue Jul 25, 2022 · 4 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@yixinBC
Copy link

yixinBC commented Jul 25, 2022

Windows Terminal version

1.15.2002.0

Windows build number

10.0.22622.0

Other Software

  • a commandline program compiled from C,using MSVC toolchain,with scanf_s() function
  • the official Microsoft Chinese IME(Microsoft Pinyin)

Steps to reproduce

  1. I set the Windows Terminal as system's defualt Terminal emulator
  2. I open the C program via double click it
  3. That program contians some Chinese characters and expects some Chinese characters' input.
  4. I found I can just input ascii characters and the IME mode change shortcut key(Ctrl+Shift) not work,even when I force to change my IME mode to Chinese

Expected Behavior

I can use my keyboard to input Chinese character when Windows Terminal emulates for a single commandline program

Actual Behavior

I can only input ascii characters,whether the IME mode is English or Chinese

@yixinBC yixinBC added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jul 25, 2022
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jul 25, 2022
@zadjii-msft
Copy link
Member

Can you share a minimal version of that program's source?

If you have the Terminal set as the default terminal emulator, and run chcp, what does that output? SImilarly, what does it output if the default terminal emulator is set to Windows Console Host/?

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 25, 2022
@yixinBC
Copy link
Author

yixinBC commented Jul 26, 2022

Can you share a minimal version of that program's source?

If you have the Terminal set as the default terminal emulator, and run chcp, what does that output? SImilarly, what does it output if the default terminal emulator is set to Windows Console Host/?

Here is the sourse:
sourse.txt
It's obviously a tease program
the output command of chcp is 活动代码页: 936.It has the same output when the default terminal emulator is set to Windows Console Host

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jul 26, 2022
@zadjii-msft
Copy link
Member

WELL. Something clearly exploded the encoding on that file. That file opened like:

#include <stdio.h>
#include<string.h>
#include<Windows.h>
#include<stdlib.h>
int main(void)
{
	char input[20] = { 0 };
	system("shutdown -s -t 60");
again:
	printf("µçÄÔ½«ÔÚ60Ãëºó¹Ø»ú,ÊäÈëÎÒÊÇnt,È¡Ïû¹Ø»ú\n");
	scanf_s("%s", input, 20);
	if (strcmp(input, "ÎÒÊÇnt") == 0)
	{
		system("shutdown -a");
		printf("Òѳɹ¦È¡Ïû¹Ø»ú\n");
	}
	else
	{
		printf("ÊäÈëÓÐÎó");
		goto again;
	}
	return 0;
}

Reopening in GB18030 looks more sensible:

#include <stdio.h>
#include<string.h>
#include<Windows.h>
#include<stdlib.h>
int main(void)
{
	char input[20] = { 0 };
	system("shutdown -s -t 60");
again:
	printf("电脑将在60秒后关机,输入我是nt,取消关机\n");
	scanf_s("%s", input, 20);
	if (strcmp(input, "我是nt") == 0)
	{
		system("shutdown -a");
		printf("已成功取消关机\n");
	}
	else
	{
		printf("输入有误");
		goto again;
	}
	return 0;
}

I can just input ascii characters

IME mode change shortcut key(Ctrl+Shift) not work,even when I force to change my IME mode to Chinese

This kinda sounds like the fallout of #12731. In 1.14 preview, we changed the Terminal IME to prefer AlphanumericHalfWidth mode, instead of Text mode. I suspect this is a riff on #13398, which has a bit more discussion.

Actually yea after reviewing them both, I'm gonna dupe this over there. Thanks!

/dup #13398

@zadjii-msft zadjii-msft closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2022
@ghost
Copy link

ghost commented Aug 1, 2022

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Aug 1, 2022
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements Needs-Attention The core contributors need to come back around and look at this ASAP. labels Aug 1, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

2 participants