Marta Karas
Marta Karas

Reputation: 5155

vim how to remove encoding special signs

I have a document in vim which contains encoding-related chars I want to get rid of (e.g. replace with "").

I have a general problem in describing their origin. There are examples of how they are displayed in different editors (my desired tool to get rid of them is vim).

Oś<9c>więcim (<9c> is a part I would like to get rid of)

enter image description here

(but copy-paste copies without this 'square' sign)

enter image description here

Please note there are other Polish-langauage-specific signs in my text whcih are displayed correct.

Q: how to regex it out in vim?

Upvotes: 0

Views: 313

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172540

You can enter the <9c> via :help i_CTRL-V_digit by pressing Ctrl + V (on Windows, often Ctrl + Q instead), followed by X and the hexadecimal number:

:%s/<C-V>x9c//g

Alternatively, the special \%x9c regular expression atom matches that value:

:%s/\%x9c//g

Alternatively, you could also just yank the character when the cursor is on it via yl, and then paste in the :s command-line via <C-R>".

Upvotes: 1

Related Questions