HTML Hex Encoding

  • Thread starter Thread starter cboekhoudt
  • Start date Start date
C

cboekhoudt

Does anyone know how and if it's possible to convert a
string like:

<div><a href="http://www.cnn.com">www.cnn.com</a></div>
<div>test string</div>

to something like this:

"\u003cdiv\u003e\u003ca href=\u0022http://www.cnn.com\u0022
\u003ewww.cnn.com\u003c/a\u003e\u003c/div\u003e\r\n\u003cdi
v\u003etest string\u003c/div\u003e"

I would like to do this using some kind of encoding
without having to escape each special character if possible

Any suggestions is greatly appreciated.
Thanks
 
UrlEncode would give me something like
%3cdiv%3e%3ca+href%3d%22http%3a%2f%2fwww.cnn.com%22%
3ewww.cnn.com%3c%2fa%3e%3c%2fdiv%3e%3cdiv%3etest+string%3
UrlEncode is not what I need.

I need it to escape characters that are html specific such
as < > and include " '. Other than manually replace all
these with the hex, are there any special encodings that
will do it for me?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top