0

I have an html file that I need to replace some characters with html entities. Right now I'm trying to replace with — but when I use the Replace All button, the result is that all of those instances of are replaced with —mdash;

I thought maybe escaping the "&" will work, so I changed the Replace with value to \— but that just results in \—mdash;

The strange thing is that if I go to each, one by one, i.e., click Next, then click Replace, and so on, then it replaces it correctly.

Is this a bug in MacVim? Or am I missing something?

paul smith
  • 1,327
  • 4
  • 17
  • 32

1 Answers1

0

Enter into command line:

:%s/—/\—/g

Also it's possible to get character code. Place your cursor on the character and press ga. Use decimal, hex or octal code into replacement string:

\%d match specified decimal character
\%x match specified hex character
\%o match specified octal character
\%u match specified multibyte character 
\%U match specified large multibyte character

:%s/\%d8212/\$mdash;/g
Valery Viktorovsky
  • 6,487
  • 3
  • 39
  • 47
  • Do you mind explaining why the Replace all doesn't work? I feel like such a trivial task shouldn't require this much work :) – paul smith Mar 13 '13 at 21:04