473,503 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert latin-1 characters to named HTML entities?


Is there a function in the .Net 1.1 framework
that will take, say, a string containing Scandinavian
characters and output the corret HTML entities, such
as

æ
ø
å

etc.

I am currently using FreeTextBox, but while it seems to
convert some characters (<, >, ...), others are left alone
and need to be converted separately.

I cannot use Response.Write or similar: I am taking freeform
input from FreeTextBox and normal textboxes and creating
static HTML files for later use, using String.Replace.

Basically, I need something that will convert the first column
to the third in
http://msdn.microsoft.com/workshop/a...s/charset1.asp
but if there is already something in the framework for this purpose
I would feel silly writing my own (probably slower) function.

TIA,

Joergen Bech

Nov 19 '05 #1
2 2647
Joergen Bech wrote:

Is there a function in the .Net 1.1 framework
that will take, say, a string containing Scandinavian
characters and output the corret HTML entities, such
as

&aelig;
&oslash;
&aring;

etc.

I am currently using FreeTextBox, but while it seems to
convert some characters (<, >, ...), others are left alone
and need to be converted separately.

I cannot use Response.Write or similar: I am taking freeform
input from FreeTextBox and normal textboxes and creating
static HTML files for later use, using String.Replace.

Basically, I need something that will convert the first column
to the third in
http://msdn.microsoft.com/workshop/a...e/charsets/cha
rset1.asp but if there is already something in the framework for this
purpose I would feel silly writing my own (probably slower) function.


Do you really need character references, or will numeric references
work for you as well (they should)?

System.Web.HttpUtility.HtmlEncode() and
System.Web.HttpServerUtility.HtmlEncode() (which calls the other one)
do that trick. You may find though that the encoded output uses both
character and numeric references (see http://tinyurl.com/9bq6g).

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #2
On Mon, 13 Jun 2005 13:25:41 -0700, "Joerg Jooss"
<ne********@joergjooss.de> wrote:
Joergen Bech wrote:

Is there a function in the .Net 1.1 framework
that will take, say, a string containing Scandinavian
characters and output the corret HTML entities, such
as

&aelig;
&oslash;
&aring;

etc.

I am currently using FreeTextBox, but while it seems to
convert some characters (<, >, ...), others are left alone
and need to be converted separately.

I cannot use Response.Write or similar: I am taking freeform
input from FreeTextBox and normal textboxes and creating
static HTML files for later use, using String.Replace.

Basically, I need something that will convert the first column
to the third in
http://msdn.microsoft.com/workshop/a...e/charsets/cha
rset1.asp but if there is already something in the framework for this
purpose I would feel silly writing my own (probably slower) function.


Do you really need character references, or will numeric references
work for you as well (they should)?

System.Web.HttpUtility.HtmlEncode() and
System.Web.HttpServerUtility.HtmlEncode() (which calls the other one)
do that trick. You may find though that the encoded output uses both
character and numeric references (see http://tinyurl.com/9bq6g).

Cheers,


Thanks. I'll try. Trouble is, I would like everything to be named
html entities (for other reasons). I'll have to use HTMLEncode if a
few custom string replacements turn out to insufficient.

Sure am surprised, though, that it seems so hard to find a
function for this purpose (in .Net). Something like:
http://maconlinux.net/linux-man-page...ntities.3.html

The Microsoft.SharePoint.Utilities.SPEncode class sounds useful,
but not to me, as this is not a SharePoint application.

I'll have to investigate the possibilities later.

Regards,

Joergen Bech

Nov 19 '05 #3

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

Similar topics

23
25877
by: Hallvard B Furuseth | last post by:
Has someone got a Python routine or module which converts Unicode strings to lowercase (or uppercase)? What I actually need to do is to compare a number of strings in a case-insensitive manner,...
4
6128
by: Uwe Mayer | last post by:
Hi, in a PyQt application I'm writing, the user can select a filename with a FileDialog. Then I would like to open this file. This works fine if there are no "special symbols" in the filename,...
30
8607
by: John Carroll | last post by:
Does anyone have a function or procedure for converting integers to character strings? Thank you, John
4
2590
by: Trond Hoiberg | last post by:
I was wondering if someone in here knows if it is possible to convert a letter (a, b, c....) to the ISO Latin-1 Character Set Decimal code? a= a b=b c=c I know it is possible but i was looking...
7
3121
by: manstey | last post by:
Hi, How do I convert a string like: a="{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}" into a dictionary: b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS':...
10
22787
by: ahoway | last post by:
I am having problems entering a sentence for translating into pig latin. It is set up now to read the entire sentence as one word. I would like to know how to look at each word in the sentence so...
2
2734
by: tgirard | last post by:
Hello to all Before I pull all my hair out... I have a problem with a text string (actually read in from a cell-phone appointment sent to the computer) which has a 'strange' utf-8 encoding. Let...
29
5053
by: Harlin Seritt | last post by:
Hi... I would like to take a string like 'supercalifragilisticexpialidocius' and write it to a file in binary forms -- this way a user cannot read the string in case they were try to open in...
15
8316
by: Lyosha | last post by:
Converting binary to base 10 is easy: 255 Converting base 10 number to hex or octal is easy: '0144' '0x64' Is there an *easy* way to convert a number to binary?
1
1675
by: Helmut Jarausch | last post by:
Hi, I'm trying to teach "dugui.py" (a tiny GUI for restructuredtext written in wxPython) to accept files in isolatin-1 encoding. It displays e.g. German umlauts correctly but then I get a...
0
7204
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,...
0
7091
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
7282
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
7342
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...
1
6998
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...
0
7464
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
5018
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
4680
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
1516
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 ...

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.