473,499 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert special characters

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
Nov 16 '05 #1
5 16131
Hi,

Is System.Web.HttpUtility.HtmlEncode() what you are looking for?
"Frederik" <ae************@hotmail.com> wrote in message
news:97**************************@posting.google.c om...
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
Nov 16 '05 #2
> 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
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

Nov 16 '05 #3
Add a reference to the System.Web assembly.
(Right-click on References in Solution Explorer and select Add Reference.)

- Magnus

"Frederik" <ae************@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP12.phx.gbl...
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
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


Nov 16 '05 #4
Yes, as Magnus suggested, add a reference to System.Web.dll.

"Frederik" <ae************@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP12.phx.gbl...
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
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


Nov 16 '05 #5
> Add a reference to the System.Web assembly.
(Right-click on References in Solution Explorer
and select Add Reference.) Yes, as Magnus suggested, add a reference to System.Web.dll.


Thanx Magnus and Shiva! It runs fine now! :-))
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
8944
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP,...
6
10127
by: Ricardo Quintanilla | last post by:
i have a code that sends data to a socket listening over as400 platform, the socket responds to me as a "byte array". then i need to convert the "byte array" into a string. the problem is that...
4
11282
by: Kueishiong Tu | last post by:
How do I convert a managed String type to a native char type? If nothing is availbale, how do I copy the the contents of the String object to a char array?
4
2279
by: BADEV | last post by:
I've an multi-line edit box on an html page that I use to collect detailed description information. I'd also like to display that information on an html page... How do I convert it to hmtl so...
4
20836
by: Paw Pedersen | last post by:
When using Encoding.Convert to convert from UTF-8 to ISO646-US the special Chars like ÆØÅ are replaced with a questionmark (?). Is there any other way to convert between encodings where you can set...
1
7671
by: Robert Dodier | last post by:
Hello, Sorry for asking what must be a FAQ, but I wasn't able to find the answer. I have an XML document fragment which I want to store as a text string. I want a function to convert any XML...
3
10172
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
10
2144
by: annalisa | last post by:
I really need some help with langauge conversion to HTML. My translators are translating into Word and I need to convert Word to HTML. It's been awhile since I've worked with Unicode and know that...
2
4855
by: neovantage | last post by:
hey geeks, I am using a function which convert unicode to entities. So that i can save values into mysql database into entities. This function really helps me when i display the store entity data...
0
7009
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.