Monday, March 26, 2012

HTML encoding method?

hello,

i need to do some HTML encoding on some strings. not UrlEncoding, mind
you, but HTML encoding. ie:

"&" to "&"
"<" to "<"

...etc. does anyone know of a good way to do this, other than manual
string replacements? what of decoding back into plain text?

thanks,
mattHttpServerUtility.HtmlEncode() is what you're looking for. Here's MS
documentation on it:

http://msdn2.microsoft.com/en-gb/library/w3te6wfz.aspx
I just googled [.NET + HTMLEncode] and got over 200,000 links on this... the
above is just one of them

HTH

<matt@.mailinator.comwrote in message
news:1171050927.250882.317160@.h3g2000cwc.googlegro ups.com...

Quote:

Originally Posted by

hello,
>
i need to do some HTML encoding on some strings. not UrlEncoding, mind
you, but HTML encoding. ie:
>
"&" to "&"
"<" to "<"
>
...etc. does anyone know of a good way to do this, other than manual
string replacements? what of decoding back into plain text?
>
>
thanks,
matt
>


On Feb 9, 2:20 pm, "Bob Johnson" <A...@.B.comwrote:

Quote:

Originally Posted by

HttpServerUtility.HtmlEncode() is what you're looking for. Here's MS
documentation on it:


ah sweet, thanks.

Quote:

Originally Posted by

I just googled [.NET + HTMLEncode] and got over 200,000 links on this... the
above is just one of them


...i had tried some other keyword variations, didnt come up w/ the
MSDN result; but sure enough thats the documentation i needed.

thanks
matt

No comments:

Post a Comment