Why does VIM show the Unicode code point and not the UTF-8 code value

encodingunicodeutf-8vim

Consider this supposed line of code that I found in a PHP blog, note the quotes:

throw new Exception(“That's not a server name!”);

Those quotes are RIGHT DOUBLE QUOTATION MARK (Unicode code point: U+201D; UTF-8 hex-encoded value: 0xE2 0x80 0x9D). Pressing ga in VIM displays the following in the status bar:

<”> 8221, Hex 201d, Octal 20035

Why is the Unicode code point being displayed and not the UTF-8 code value?

Considering that the file is stored as UTF-8 and it is the terminal translating the bytes into glyphs, I would expect VIM to show the raw value of the file (UTF-8 code value), not to translate it into a Unicode code point.

Best Answer

Why is the Unicode code point being displayed and not the UTF-8 code value?

Because you use ga:

<”> 8221, Hex 201d, Octal 20035

instead of g8:

e2 80 9d