473,805 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unicode to HTML converter/cleaner

Rob
Is there a handy .NET call to convert a Unicode string to valid HTML so
sticking in an <pinner HTML? Kind of thing converts "<" to &lt and
multiple spaces to &nbsp etc. I need to display unicode text from a database
on the web page.

Cheers, Rob.
Nov 14 '07 #1
6 1891

I suppose you need to smth like System.Text.Enc oding.Convert and
HttpServerUtili ty.HtmlEncode methods

Btw, all strings in .NET are unicode ones

--
WBR, Michael Nemtsev [.NET/C# MVP].
Blog: http://spaces.live.com/laflour

"Rob" wrote:
Is there a handy .NET call to convert a Unicode string to valid HTML so
sticking in an <pinner HTML? Kind of thing converts "<" to &lt and
multiple spaces to &nbsp etc. I need to display unicode text from a database
on the web page.

Cheers, Rob.
Nov 15 '07 #2

I suppose you need to smth like System.Text.Enc oding.Convert and
HttpServerUtili ty.HtmlEncode methods

Btw, all strings in .NET are unicode ones

--
WBR, Michael Nemtsev [.NET/C# MVP].
Blog: http://spaces.live.com/laflour

"Rob" wrote:
Is there a handy .NET call to convert a Unicode string to valid HTML so
sticking in an <pinner HTML? Kind of thing converts "<" to &lt and
multiple spaces to &nbsp etc. I need to display unicode text from a database
on the web page.

Cheers, Rob.
Nov 15 '07 #3
Rob
I suppose you need to smth like System.Text.Enc oding.Convert and
HttpServerUtili ty.HtmlEncode methods
Thanks - I'll have a look at those.

Cheers, Rob.
Nov 19 '07 #4
"Gran Andersson" <gu***@guffa.co mwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
If you are using HTML, it's <br>. If you are using XHTML, it's <br/>.
At the risk of extreme pedantry, it's <br />, not <br/>

:-)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 20 '07 #5
Rob
At the risk of extreme pedantry, it's <br />, not <br/>

Yes I'd read that somewhere but then seen many places where the space was
been dropped.

Such as internet standards :-)

Cheers, Rob.
Nov 21 '07 #6
"Rob" <rob_nicholson@ nospam_unforget table.comwrote in message
news:0w******** ********@newsfe 4-gui.ntli.net...
>At the risk of extreme pedantry, it's <br />, not <br/>

Yes I'd read that somewhere but then seen many places where the space was
been dropped.
Of course you have - the Internet is littered with badly-formed markup...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 21 '07 #7

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

Similar topics

3
17626
by: Michael Weir | last post by:
I'm sure this is a very simple thing to do, once you know how to do it, but I am having no fun at all trying to write utf-8 strings to a unicode file. Does anyone have a couple of lines of code that - opens a file appropriately for output - writes to this file Thanks very much. Michael Weir
12
10709
by: Peter Wilkinson | last post by:
Hello tlistmembers, I am using the encoding function to convert unicode to ascii. At one point this code was working just fine, however, now it has broken. I am reading a text file that has is in unicode (I am unsure of which flavour or bit depth). as I read in the file one line at a time (readlines()) it converts to ascii. Simple enough. At the same time I am copressing to bz2 with the bz2 module but that works just fine. The code...
27
5154
by: EU citizen | last post by:
Do web pages have to be created in unicode in order to use UTF-8 encoding? If so, can anyone name a free application which I can use under Windows 98 to create web pages?
20
7360
by: Al Moritz | last post by:
Hi all, I was always told that the conversion of Word files to HTML as done by Word itself sucks - you get a lot of unnecessary code that can influence the design on web browsers other than Internet Explorer. Our computer expert in my company had told me already a while ago that I should learn HTML and encode myself. I was never inclined to do so (I am no computer expert), and when upon his suggestion I looked how my pages (converted to...
48
4651
by: Zenobia | last post by:
Recently I was editing a document in GoLive 6. I like GoLive because it has some nice features such as: * rewrite source code * check syntax * global search & replace (through several files at once) * regular expression search & replace. Normally my documents are encoded with the ISO setting. Recently I was writing an XHTML document. After changing the encoding to UTF-8 I used the
40
4045
by: apprentice | last post by:
Hello, I'm writing an class library that I imagine people from different countries might be interested in using, so I'm considering what needs to be provided to support foreign languages, including asian languages (chinese, japanese, korean, etc). First of all, strings will be passed to my class methods, some of which based on the language (and on the encoding) might contain characters that require more that a single byte.
4
1650
by: Justin | last post by:
Hi, i need some help on this urgently... Thanx.... The situation is like this, i need to find out the way to convert Chinese characters into hexa code. but the problem is what i got from bin2hex() is not giving the desired output. below is the sample of what i want: input : 新聞首頁 output: 65B0805E99969801 (this is the output from some converter for non english language UCS) output: %e6%96%b0%e8%81%9e%e9%a6%96%e9%a0%81 (this is the...
9
22872
by: mistral | last post by:
Is there some Unicode converter to convert javascript to Unicode format? thanks mistral
2
1895
by: schneider | last post by:
as a biginner, maybe I have a question already answered 1000 times but I do not know how to find the answers. problem: depending on an input value, I would like to output greek characters (f. e. those between U+03B1 to U+03C9. One way would be to define two arrays: one with the possible input values ("abgde...") and a second
0
9716
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10356
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...
0
10103
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7644
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
6874
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
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
3
3006
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.