Friday, January 21, 2011

cp1252 characters when enc=utf-8, fenc=cp1252

I have a file encoded as cp1252. I have my encoding set to utf-8, and
my fileencodings set up such that when this file is read in, it gets
an fenc of cp1252 and is read in properly.

In this file is an en dash, encoded as byte value 150. The Unicode
value for this is 8211.

I would expect that pressing ga on this character would show 150, but
instead it shows 8211. Why?

Furthermore, I would expect to be able to enter this character by
typing <C-V>150 in insert mode, or by typing <C-V>u2013. However, only
the latter works.

Finally, I would expect to be able to search for this character using
either /[\d150] or /[\u2013], but again only the latter works.

Is Vim supposed to act this way? Why?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: