Control character 0x96 sneaks in when copying from or pasting to Git Bash terminal window

2

0

I'm on Windows 10 and I'm using Git Bash.

When I copy from or paste into this window, sometimes are stray character `` (decimal 150, hex 0x96) appears in the beginning of the string.

This character is typically invisible, which results in errors like "command not found". I've been struggling with those for a long time, before I connected the issue to copy-pasting.

Finally, I was lucky to paste some text as an argument into a command which opened a browser with an URL containing pasted text, and in the browser address field the character was visible:

enter image description here

I am 100% certain that it's the pasting action that produces this character. I. e. if I copy the text directly from source to browser, the character does not appear. If I type the same text manually into Git Bash, the character does not appear. But if I paste text into Git Bash, the character appears.

It's a huge nuisance. I'm getting desperate, since I don't understand what mechanism produces it.

Character 150 is special. Here's what I managed to google up:

Start of Guarded Protected Area, Start of Protected Area, Start of Guarded Area

Starts a string of character positions that can't be altered manually or transmitted. Optionally protects against erasure too. EPA will end the string.

Question: How do I stop this character from sneaking into text pasted into Git Bash?

lolmaus - Andrey Mikhaylov

Posted 2018-06-15T10:04:38.150

Reputation: 383

Answers

1

Ok, this is caused by me doing unnecessary keypresses.

From Linux, I have a habit of pasting with Ctrl+Shift+V. When this command does not paste in a Windows Git Bash terminal, I remember to press Shift+Ins instead.

Ctrl+Shift+V seems to have no effect, but it actually inserts an invisible control character.

If I happen to press Ctrl+Shift+V in the beginning of the command, the result would look like this:

enter image description here

When I attempt to copy that and paste into the browser, it appears like this:

$ echo
bash: $'\302\203\302\226echo': command not found

UPD: mintty, the terminal that backs Git Bash, has an option to switch to Ctrl+Shift+C/V key combinations!

lolmaus - Andrey Mikhaylov

Posted 2018-06-15T10:04:38.150

Reputation: 383