473,624 Members | 2,216 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 16142
Hi,

Is System.Web.Http Utility.HtmlEnc ode() what you are looking for?
"Frederik" <ae************ @hotmail.com> wrote in message
news:97******** *************** ***@posting.goo gle.com...
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.Http Utility.HtmlEnc ode() 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******** ******@TK2MSFTN GP12.phx.gbl...
Is System.Web.Http Utility.HtmlEnc ode() 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******** ******@TK2MSFTN GP12.phx.gbl...
Is System.Web.Http Utility.HtmlEnc ode() 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
8986
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, mainly because I need the ability to both create and extract zip-files. I've tried a couple of classes found here and there, and they all seem to have the same problem. I'm currently using PclZip (http://phpconcept.net/pclzip/) but even the...
6
10177
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 the data converted from the byte array into a string , is not what i expect. example: - the data returned from the socket is (byte array) "Usuario Sin Atribuciones Para Esta Función"
4
11286
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
2282
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 that line feeds and other special characters are displayed properly.
4
20890
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 the char used to replace the special chars, or where the special chars is simply left out instead? Since this is for an EDI document it won't work with a questionmark. Regards Paw
1
7700
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 special characters such as < > into the corresponding character entities. I'm working with Java.
3
10191
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. This is not a regular expression tutorial. Assumes you are already familiar with basic regular expression concepts and terminology. If not, you may want to read some regular expression tutorial. See the end of the article for links to online resources....
10
2155
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 not all the fonts being used are unicode. Is there a way to strip all the junk out of the MS Word filtered (yeah right) HTML. All I want are the basic formatting tags no spans,fonts, divs, css, but I don't want to lose any language identification...
2
4866
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 into web page n it shows special charactor easily. Here is the function code function charset_decode_utf_8($string) { /* Only do the slow convert if there are 8-bit characters */ /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not...
0
8234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8677
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8620
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2605
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 we have to send another system
2
1482
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.