Monday, April 4, 2016

How Encoding decoding utf-16 html charset entity

Hi,

I've got some CDATA sections in html source and want to pass easily from utf-16 characters to ascii chars and opposite operation.

I'am currently using a dict to make needed substitutions. Is it possible to avoid this king of func passing by some others predefined commands ?


fun! TestFunc2() "{{{
"
" 02 Convert Code
"

let mydict={'&quot;':'"', '&apos;':"'", '&lt;':'<', '&gt;':'>',
'&#xD;':'\r', '&#xA;':'\n', '&amp;':'&' }

let item=""
for item in keys(mydict)
exe "silent! %s/".item.'/\=get(mydict, submatch(0), submatch(0))/g'
endfor

set ft=vb
norm 1G

endfunction "}}}

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: