0

I am using curl on my Macos Catalina terminal app, and the text I enter in stdin gets altered on me pressing enter Enter. For a simple example:

curl -d " 印度是最好的 The weather is good" -X POST http://localhost:8000/questions/21/
curl: (1) Protocol "hhttp" not supported or disabled in libcurl

is actually entered as :

 curl -d " 印度是最好的 The weather is good" -X POST hhttp://localhost:8000/questions/21/

, which I can see from previous command on terminal Control + P.

P.S - I've entered the command and thus, it shows libcurl error.

For an english sentence - you can see the error below:

terminal error

I have no idea why this is happening, I'm using zsh shell and ohmyzsh along with it - and this is happening the first time to me.

Adding an image here too, for further investigation.

terminal typing problems

My .zshrc configuration is here

8
  • Probably a bug in terminal. I tried copy-pasting the line you posted into Terminal.app on macOS Big Sur and it does not work at all. It basically breaks from the first Chinese character onwards. Commented May 14, 2021 at 12:37
  • @MarlonRichert - Actually, it isn't a problem with chinese text, it happens to me for regular english text too!
    – aspiring1
    Commented May 14, 2021 at 14:16
  • 2
    Turn off OhMyZsh (and leave it off, it's a cancer). Does the problem still occur? Commented May 14, 2021 at 17:58
  • There isn't enough information to help you here. It's difficult to diagnose this without trying things out. To get help, you need to figure out a way other people can reproduce the problem. The first step is to see if you can reproduce in another terminal window. Then, see if you can reproduce without your .zshrc; if you can't, you'll need to post your complete .zshrc and all the files it loads. If you can reproduce it without Chinese text, it would help. Commented May 15, 2021 at 10:49
  • Does it matter whether you typed the command or copy-pasted? Can you reproduce this with commands other than curl? If you press Up to edit the command line, does the extra h appear? If you run fc to edit the last command in an external editor, does the extra h appear? Is the problem always with the letter h or sometimes with other letters? Does the problem occur with every h or only some? Does the problem occur with other terminals such as iTerm? Commented May 15, 2021 at 10:51

1 Answer 1

2

I don't have any problem with trying to paste that line into zsh running in Terminal.app. Some testing...

zsh: processed normally
dash: processed normally
oksh: processed normally
pdksh: processed normally
tcsh: processed normally
bash: processed normally
fish: processed normally
ksh: takes the Chinese as editor commands and weirds out

I'll report that as a ksh bug, I suppose.

But your problem would seem to be OhMyZsh, not Terminal.app. I can replicate the ksh behavior in iTerm as well.

Edit: ksh has a bug with multibyte characters and the KEYBD trap. See https://github.com/ksh93/ksh/issues/307 and https://github.com/att/ast/issues/197

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .