Reputation: 732
I want to search and replace "<e9>" by "é".
:%s/<e9>/é/g
Doesn't works but <e9> seems vim special char
/ ctrl+v xe9
find only the correct "é" but not "<e9>"
If i'm on <e9> and i type :ascii i've got this result:
<é> 233, Hexa 00e9, Octal 351
If i'm on "é" and i type :ascii i've got this result:
<é> 233, Hexa 00e9, Octal 351
Upvotes: 0
Views: 1559
Reputation: 2120
AFAIK <e9>
is a single character somehow corrupted with encoding conversions.
At command mode, when your cursor is on <e9>
give command yl
. This will yank the character to buffer. Then search for the yanked character by giving command /<C-R>-
(This involves going to search mode, pressing CTRL+R
and pressing -
.) Your search should find all the <e9>
chars in text. Finally do a substitution by using the last search result:
%s//é/g
Upvotes: 0
Reputation: 172688
Your text already contains the proper é
character (as shown by the :ascii
command), it's just that Vim doesn't display it like that. (You can verify with another text lister / editor.)
How characters are displayed is governed by the 'isprint'
option. Its help says:
When 'encoding' is a Unicode one, illegal bytes from 128 to 255 are displayed as
<xx>
, with the hexadecimal value of the byte.
So, assuming you haven't change the 'isprint' value, you likely have an issue with the detection of the encoding. Check
:set encoding? fileencodings? fileencoding?
and correct.
Upvotes: 4