convert special characters

  • Thread starter Thread starter Frederik
  • Start date Start date
F

Frederik

Hi all,

I wonder if C# has a build-in utility to convert special characters
(for example "&", "<", ">") to the corresponding html entities. If
such a utility is not available, can someone tell me what to do best
to make the conversion (regular expressions?).

Thanx in advance,
Frederik
 
Hi,

Is System.Web.HttpUtility.HtmlEncode() what you are looking for?


Hi all,

I wonder if C# has a build-in utility to convert special characters
(for example "&", "<", ">") to the corresponding html entities. If
such a utility is not available, can someone tell me what to do best
to make the conversion (regular expressions?).

Thanx in advance,
Frederik
 
Is System.Web.HttpUtility.HtmlEncode() what you are looking for?

Hi Shiva,

That method seems to be useful, but I can't use it!!! The namespace can't be
found when compiling. Any idea why? I'm using Visual Studio 2003 and I'm
working on a Win32 application.

Regards,
Frederik
 
Add a reference to the System.Web assembly.
(Right-click on References in Solution Explorer and select Add Reference.)

- Magnus
 
Yes, as Magnus suggested, add a reference to System.Web.dll.

Frederik said:
Is System.Web.HttpUtility.HtmlEncode() what you are looking for?

Hi Shiva,

That method seems to be useful, but I can't use it!!! The namespace can't be
found when compiling. Any idea why? I'm using Visual Studio 2003 and I'm
working on a Win32 application.

Regards,
Frederik
 
Back
Top