This will help if you receive text (e.g, email from wrongly configured clients) with lots of '\nnn' or '&#nnn;' strings, where n is a digit. These 'nnn' are the decimal codes of non-ascii characters. To convert all at the same time, you can do the following:
+
This will help if you receive text (e.g, email from wrongly configured clients) with lots of '\nnn' or '&#nnn;' strings, where n is a digit. These 'nnn' are the decimal codes of non-ascii characters. To convert all at the same time, you can do the following:
<pre>
<pre>
:%s/\\\([0-9]*\)/\=nr2char(submatch(1))/g
:%s/\\\([0-9]*\)/\=nr2char(submatch(1))/g
or
or
−
:%s/&#\([0-9]*\);/\=nr2char(submatch(1))/g
+
:%s/&#\([0-9]*\);/\=nr2char(submatch(1))/g
</pre>
</pre>
Line 25:
Line 25:
==Comments==
==Comments==
−
−
----
Latest revision as of 00:07, September 30, 2008
Please review this tip:
This tip was imported from vim.org and needs general review.
created May 25, 2006 · complexity basic · author Luis A. Florit · version 5.7
This will help if you receive text (e.g, email from wrongly configured clients) with lots of '\nnn' or '&#nnn;' strings, where n is a digit. These 'nnn' are the decimal codes of non-ascii characters. To convert all at the same time, you can do the following:
:%s/\\\([0-9]*\)/\=nr2char(submatch(1))/g
or
:%s/&#\([0-9]*\);/\=nr2char(submatch(1))/g