473,396 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

replacing strange characters pulled from db field

I have a description field where people are putting in all kinds of non
html characters. When they're being pulled from the db, they're coming
out like • or  or any number of things. Does anyone have
a C# function written that would fix these? It's for a C# v1 project,
not v2. Thanks.

Jul 7 '06 #1
3 1127
vtxr1300,

Use the static HtmlEncode and HtmlDecode methods on the HttpUtility
class in the System.Web namespace, located in System.Web.dll.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"vtxr1300" <ca********@hotmail.comwrote in message
news:11**********************@s53g2000cws.googlegr oups.com...
I have a description field where people are putting in all kinds of non
html characters. When they're being pulled from the db, they're coming
out like â?¢ or  or any number of things. Does anyone have
a C# function written that would fix these? It's for a C# v1 project,
not v2. Thanks.
Jul 7 '06 #2
vtxr1300 <ca********@hotmail.comwrote:
I have a description field where people are putting in all kinds of non
html characters. When they're being pulled from the db, they're coming
out like â?¢ or  or any number of things. Does anyone have
a C# function written that would fix these? It's for a C# v1 project,
not v2. Thanks.
First you need to identify where the problem is.

See http://www.pobox.com/~skeet/csharp/d...ngunicode.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jul 7 '06 #3

Nicholas Paldino [.NET/C# MVP] wrote:
vtxr1300,

Use the static HtmlEncode and HtmlDecode methods on the HttpUtility
class in the System.Web namespace, located in System.Web.dll.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
I originally tried that, but it also encoded all of the html formatting
that was in the string. I need to preserve that. I'll look at Jon's
recommendation and see if I can make sense of that. Thanks.

Jul 7 '06 #4

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

Similar topics

2
by: Richard S. Crawford | last post by:
I have a large table, tblMessage, which stores e-mail messages in text fields. I need to remove the carriage returns the data in these fields, but I have not yet figured out how to do so. I...
5
by: Bill Grigg | last post by:
I am attempting to set the UnicodeCompression property via code. The following line "appears" to work: tdf.Fields("State").Properties("UnicodeCompression").Value = True I can see the boolean...
3
by: Jim Irvine | last post by:
I have a small database made up of 2 tables. I have a report that is driven from a query. On the report are a couple of fields linked to memo boxes in the table. Everytime I run the report I get...
7
by: Frank.Sebesta | last post by:
I have a wedge mag stripe reader that I swipe when ask to input information in a query. How do I filter the unwanted characters. Apparently there are two mag stripes that are read every time I...
12
by: anonymous | last post by:
Hello, I need to replace this char  with another char. However I am not able to acieve this. I tried this but it doesnt work: str = str.Replace(chr(asc(194)), "") Can somebody help ?
0
by: Ben Holness | last post by:
Hi all, I have a system which allows users to enter a message on a (PHP) website. This message is then put into a (MySQL) Database. A perl script then picks up the message and creates an XML...
2
by: Alain | last post by:
Hi, I am working on a project where I need to convert international characters with acii values. Like André -> andre and Björn -> bjorn. How can I do this without replacing every single...
2
by: Keith Wilby | last post by:
I have a table containing different field types including a memo field. If I do a select distinct on the table the memo field is truncated to 256 characters. I've never encountered this before,...
2
by: gsuns82 | last post by:
Hi all, I have to replace accented characters from a input string with normal plain text.I have coded as follows. String input = "ÄÀÁÂÃ"; input=...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
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...

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.