Same input with different results in terminal and cmd.exe #8811

Open
opened 2026-01-31 01:38:37 +00:00 by claunia · 5 comments
Owner

Originally created by @jnkb on GitHub (Jun 4, 2020).

Environment

Windows build number: Microsoft Windows Pro [Version 10.0.18363.836] x64
Windows Terminal version (if applicable): 1.0.1401.0

Any other software?
stripe cli

Steps to reproduce

Download Stripe CLI (https://github.com/stripe/stripe-cli/releases/tag/v1.4.1)
after "stripe login" (not sure if needed, i was already logged in) using the command
"stripe listen --forward-to https://localhost:44391/api/StripeWebHooks" works on cmd.exe, but not in terminal

Expected behavior

should work as in cmd.exe

Actual behavior

output "unknown flag: --forward-to https://localhost:44391/api/StripeWebHooks"

Screenshot with outputs:
image

Originally created by @jnkb on GitHub (Jun 4, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: Microsoft Windows Pro [Version 10.0.18363.836] x64 Windows Terminal version (if applicable): 1.0.1401.0 Any other software? stripe cli ``` # Steps to reproduce Download Stripe CLI (https://github.com/stripe/stripe-cli/releases/tag/v1.4.1) after "_stripe login_" (not sure if needed, i was already logged in) using the command "_stripe listen --forward-to https://localhost:44391/api/StripeWebHooks_" works on cmd.exe, but not in terminal <!-- A description of how to trigger this bug. --> # Expected behavior should work as in cmd.exe # Actual behavior <!-- What's actually happening? --> output "unknown flag: --forward-to https://localhost:44391/api/StripeWebHooks" Screenshot with outputs: ![image](https://user-images.githubusercontent.com/26929742/83779879-c7722400-a68c-11ea-8328-505dff643015.png)
Author
Owner

@zadjii-msft commented on GitHub (Jun 9, 2020):

Well that just doesn't make any sense at all. I have no idea why that wouldn't work. Do other stripe CLI functions work in the Windows Terminal?

If you have WSL installed, could you try running the following for me?

  1. Open cmd.exe (not in the Windows Terminal)
  2. run wsl in that legacy console window
  3. run cmd.exe from within wsl.
  4. try running your command (stripe listen --forward-to ...) again in this window.

This might help narrow the problem down to Conpty vs the entire Windows Terminal.

@zadjii-msft commented on GitHub (Jun 9, 2020): Well that just doesn't make any sense at all. I have no idea why that wouldn't work. Do other `stripe` CLI functions work in the Windows Terminal? If you have WSL installed, could you try running the following for me? 1. Open `cmd.exe` (not in the Windows Terminal) 2. run `wsl` in that legacy console window 3. run `cmd.exe` from within wsl. 4. try running your command (`stripe listen --forward-to ...`) again in this window. This might help narrow the problem down to Conpty vs the entire Windows Terminal.
Author
Owner

@jnkb commented on GitHub (Jun 10, 2020):

Same Problem in the wls cmd:

image

I just found out that it seems to be an encoding problem.
Typing it in manually, it works. Copy & Paste does not work depending on the source.

Try copy & paste from the txt:

terminal_issue_6353.txt

Below the byte arrays of the different inputs.
The space after forward-to is different: 32 vs. 194,160. Don't know how this happend.

[...]
n    110    110
     32    32
-    45    45
-    45    45
f    102    102
o    111    111
r    114    114
w    119    119
a    97    97
r    114    114
d    100    100
-    45    45
t    116    116
o    111    111
      32    194
h    104    160
t    116    104
t    116    116
p    112    116
s    115    112
:    58    115
/    47    58
/    47    47
l    108    47
o    111    108
c    99    111
a    97    99
l    108    97
h    104    108
o    111    104
s    115    111
t    116    115

created with with

var working = "stripe listen --forward-to https://localhost:44391/api/StripeWebHooks";
var notWorking = "stripe listen --forward-to https://localhost:44391/api/StripeWebHooks";
var bytesW = Encoding.UTF8.GetBytes(working);
var bytesNW = Encoding.UTF8.GetBytes(notWorking);
for (int i = 0; i < working.Length; i++)
{
    Console.WriteLine(working[i] + "\t\t" + bytesW[i] + "\t\t" + bytesNW[i]);
}

@jnkb commented on GitHub (Jun 10, 2020): Same Problem in the wls cmd: ![image](https://user-images.githubusercontent.com/26929742/84257892-59a77b80-ab16-11ea-9c59-ae24b3decd8f.png) **I just found out that it seems to be an encoding problem.** Typing it in manually, it works. Copy & Paste does not work depending on the source. Try copy & paste from the txt: [terminal_issue_6353.txt](https://github.com/microsoft/terminal/files/4757998/terminal_issue_6353.txt) Below the byte arrays of the different inputs. The space after forward-to is different: 32 vs. 194,160. Don't know how this happend. ``` [...] n 110 110 32 32 - 45 45 - 45 45 f 102 102 o 111 111 r 114 114 w 119 119 a 97 97 r 114 114 d 100 100 - 45 45 t 116 116 o 111 111 32 194 h 104 160 t 116 104 t 116 116 p 112 116 s 115 112 : 58 115 / 47 58 / 47 47 l 108 47 o 111 108 c 99 111 a 97 99 l 108 97 h 104 108 o 111 104 s 115 111 t 116 115 ``` created with with ```cs var working = "stripe listen --forward-to https://localhost:44391/api/StripeWebHooks"; var notWorking = "stripe listen --forward-to https://localhost:44391/api/StripeWebHooks"; var bytesW = Encoding.UTF8.GetBytes(working); var bytesNW = Encoding.UTF8.GetBytes(notWorking); for (int i = 0; i < working.Length; i++) { Console.WriteLine(working[i] + "\t\t" + bytesW[i] + "\t\t" + bytesNW[i]); } ```
Author
Owner

@zadjii-msft commented on GitHub (Jun 10, 2020):

Oh, excellent work with that!

The 160 is probably a &nbsp, IIRC there's some conhost code that just translates those on paste.

The 194 though, no idea what that's doing in there...

@zadjii-msft commented on GitHub (Jun 10, 2020): Oh, excellent work with that! The [160](https://www.fileformat.info/info/unicode/char/00a0/index.htm) is probably a `&nbsp`, IIRC there's some conhost code that just translates those on paste. The 194 though, no idea what that's doing in there...
Author
Owner

@eryksun commented on GitHub (Jun 10, 2020):

The 160 is probably a &nbsp, IIRC there's some conhost code that just translates those on paste.

The 194 though, no idea what that's doing in there...

194 is 0xC2, and "\xc2\xa0" is the UTF-8 encoding of a non-breaking space, U+00A0.

@eryksun commented on GitHub (Jun 10, 2020): > The [160](https://www.fileformat.info/info/unicode/char/00a0/index.htm) is probably a `&nbsp`, IIRC there's some conhost code that just translates those on paste. > > The 194 though, no idea what that's doing in there... 194 is 0xC2, and `"\xc2\xa0"` is the UTF-8 encoding of a non-breaking space, U+00A0.
Author
Owner

@DHowett commented on GitHub (Jun 10, 2020):

bc60e6a57f/src/interactivity/win32/Clipboard.cpp (L347-L369)

Indeed!

@DHowett commented on GitHub (Jun 10, 2020): https://github.com/microsoft/terminal/blob/bc60e6a57fb48ad6aa91ae64d478d324f5dc80f4/src/interactivity/win32/Clipboard.cpp#L347-L369 Indeed!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8811