Vim shows strange characters <91>,<92>


While using Vim over SSH I copied some content from a webpage to my SSH/Vim session and got the following result:

SIZE=`df -h|grep $DISC|awk <91>{print $2}<92>`

Apparently <91> and <92> stand for ' but how can I search and replace this stuff? And what does that 91/92 mean? How is this encoded because 91/92 in ASCII mean \ and [?

Best Answer

The content on your source web page was overzealously reformatted. The text was undoubtedly supposed to use (straight) single quotes (ASCII 39/0x27, U+0027) instead of curly single quotes (U+2018 and U+2019, which are 0x91 and 0x92 in CP1252 (also known as MS-ANSI and WINDOWS-1252; a common 8-bit encoding on Windows)).

Vim is showing you the hex codes because they are not valid in whatever encoding Vim is using (probably UTF-8). If you are editing text that has already been saved in a file, then you can reload the file as CP1252 with :e ++enc=cp1252; this should make the curly quotes visible. But there is no real reason to reload it as CP1252, just delete the 0x91 and 0x92 characters and replace them with single quotes.

Related Question