HTML Hex Encoding

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cboekhoudt

    HTML Hex Encoding

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

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

    to something like this:

    "\u003cdiv\u003 e\u003ca href=\u0022http ://www.cnn.com\u00 22
    \u003ewww.cnn.c om\u003c/a\u003e\u003c/div\u003e\r\n\u 003cdi
    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
  • Swanand Mokashi

    #2
    Re: HTML Hex Encoding

    use the HttpUtility.Url Encode Method

    --
    Swanand Mokashi
    Microsoft Certified Solution Developer (.NET)
    Microsoft Certified Application Developer (.NET)
    Welcome to our website ! Well, our domain name introduces you to one half of us. The other (and perhaps better ;)) half is Rashmi Upasani. Rashmi dwells from


    Home of the Stock Quotes, Quote of the day and Horoscope web services
    "cboekhoudt " <anonymous@disc ussions.microso ft.com> wrote in message
    news:ca1801c438 fc$e91ca860$a00 1280a@phx.gbl.. .[color=blue]
    > Does anyone know how and if it's possible to convert a
    > string like:
    >
    > <div><a href="http://www.cnn.com">ww w.cnn.com</a></div>
    > <div>test string</div>
    >
    > to something like this:
    >
    > "\u003cdiv\u003 e\u003ca href=\u0022http ://www.cnn.com\u00 22
    > \u003ewww.cnn.c om\u003c/a\u003e\u003c/div\u003e\r\n\u 003cdi
    > 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[/color]


    Comment

    • Guest's Avatar

      #3
      Re: HTML Hex Encoding

      UrlEncode would give me something like
      %3cdiv%3e%3ca+h ref%3d%22http%3 a%2f%2fwww.cnn. com%22%
      3ewww.cnn.com%3 c%2fa%3e%3c%2fd iv%3e%3cdiv%3et est+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,
      [color=blue]
      >-----Original Message-----
      >use the HttpUtility.Url Encode Method
      >
      >--
      >Swanand Mokashi
      >Microsoft Certified Solution Developer (.NET)
      >Microsoft Certified Application Developer (.NET)
      >http://www.swanandmokashi.com/
      >http://www.swanandmokashi.com/HomePage/WebServices/
      >Home of the Stock Quotes, Quote of the day and Horoscope[/color]
      web services[color=blue]
      >"cboekhoudt " <anonymous@disc ussions.microso ft.com> wrote[/color]
      in message[color=blue]
      >news:ca1801c43 8fc$e91ca860$a0 01280a@phx.gbl. ..[color=green]
      >> Does anyone know how and if it's possible to convert a
      >> string like:
      >>
      >> <div><a href="http://www.cnn.com">ww w.cnn.com</a></div>
      >> <div>test string</div>
      >>
      >> to something like this:
      >>
      >> "\u003cdiv\u003 e\u003ca[/color][/color]
      href=\u0022http ://www.cnn.com\u00 22[color=blue][color=green]
      >>[/color][/color]
      \u003ewww.cnn.c om\u003c/a\u003e\u003c/div\u003e\r\n\u 003cdi[color=blue][color=green]
      >> 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[/color][/color]
      possible[color=blue][color=green]
      >>
      >> Any suggestions is greatly appreciated.
      >> Thanks[/color]
      >
      >
      >.
      >[/color]

      Comment

      Working...