473,788 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server.HTMLDeco de doesn't decode char 345

Hello!

I have a problem decoding the czech character:
r

The HTML code for this character is ř but when running
Server.HTMLdeco de on that string it just returns ř instead of the real
char. (It works on a lot of other characters)
I need to decode this string in order to render an image with this character
as a part of a headline.

Can anyone help me with this issue, or is it maybe a bug?

/kindest regards, Jonas
Nov 19 '05 #1
5 3530
This works fine for me:
Response.Write( Server.HtmlDeco de("ř"));

My web.config specifies:
<globalizatio n requestEncoding ="utf-8" responseEncodin g="utf-8" />

maybe yours is using something else?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Jonas Åkermark" <jo***@wipcore. se> wrote in message
news:uY******** ******@TK2MSFTN GP14.phx.gbl...
Hello!

I have a problem decoding the czech character:
r

The HTML code for this character is ř but when running
Server.HTMLdeco de on that string it just returns ř instead of the
real char. (It works on a lot of other characters)
I need to decode this string in order to render an image with this
character as a part of a headline.

Can anyone help me with this issue, or is it maybe a bug?

/kindest regards, Jonas

Nov 19 '05 #2
Maybe it is because I'm usning the Server object in a function in a non web
environment - a regular class:

string decodedText = System.Web.Http Context.Current .Server.HtmlDec ode(
text );

where the text property sometimes contains the char ř

Is there some way that I can tell the HtmlDecode which encoding to use?

/Jonas

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
This works fine for me:
Response.Write( Server.HtmlDeco de("ř"));

My web.config specifies:
<globalizatio n requestEncoding ="utf-8" responseEncodin g="utf-8" />

maybe yours is using something else?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Jonas Åkermark" <jo***@wipcore. se> wrote in message
news:uY******** ******@TK2MSFTN GP14.phx.gbl...
Hello!

I have a problem decoding the czech character:
r

The HTML code for this character is ř but when running
Server.HTMLdeco de on that string it just returns ř instead of the
real char. (It works on a lot of other characters)
I need to decode this string in order to render an image with this
character as a part of a headline.

Can anyone help me with this issue, or is it maybe a bug?

/kindest regards, Jonas


Nov 19 '05 #3
i don't think that's your problem (although within a class, there's no
reason not to use System.Web.Http Utility.HtmlDec ode which decouples your
class from the context (ie, it can be reused outside of the web)).

All HtmlDecode does in the case of a numeric value (such as 345), is:

char c1 = (char) ((ushort) int.Parse("345" ));
Response.Write( c1);

Is your page encoding set to utf-8? (if you put tracing on, at the top of
the trace information it says the encoding).l

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Jonas Åkermark" <jo***@wipcore. se> wrote in message
news:OE******** ******@TK2MSFTN GP14.phx.gbl...
Maybe it is because I'm usning the Server object in a function in a non
web environment - a regular class:

string decodedText = System.Web.Http Context.Current .Server.HtmlDec ode(
text );

where the text property sometimes contains the char ř

Is there some way that I can tell the HtmlDecode which encoding to use?

/Jonas

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
This works fine for me:
Response.Write( Server.HtmlDeco de("ř"));

My web.config specifies:
<globalizatio n requestEncoding ="utf-8" responseEncodin g="utf-8" />

maybe yours is using something else?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Jonas Åkermark" <jo***@wipcore. se> wrote in message
news:uY******** ******@TK2MSFTN GP14.phx.gbl...
Hello!

I have a problem decoding the czech character:
r

The HTML code for this character is ř but when running
Server.HTMLdeco de on that string it just returns ř instead of the
real char. (It works on a lot of other characters)
I need to decode this string in order to render an image with this
character as a part of a headline.

Can anyone help me with this issue, or is it maybe a bug?

/kindest regards, Jonas



Nov 19 '05 #4
Yes the encoding is set ut utf-8

the strange thing is that the decodedText property still contains the
"ř" string after HtmlDecode

Nevermind, thanks for your explanation of the HtmlDecode, I have now created
a SpecialDecode function instead that works fine

private static string SpecialDecode(s tring decodedText)
{
string tmpResult = decodedText;
bool found = true;
try
{
while(found)
{
if( tmpResult.Index Of("&#") > -1 )
{
string chars = tmpResult.Subst ring( tmpResult.Index Of("&#")+2, 3);
//decode
char c1 = (char) ((ushort) int.Parse(chars ));
tmpResult = tmpResult.Repla ce("&#" + chars + ";", c1.ToString());
}
else
{
found = false;
}
}
}
catch{}

return tmpResult;
}
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:e2******** ******@TK2MSFTN GP10.phx.gbl...
i don't think that's your problem (although within a class, there's no
reason not to use System.Web.Http Utility.HtmlDec ode which decouples your
class from the context (ie, it can be reused outside of the web)).

All HtmlDecode does in the case of a numeric value (such as 345), is:

char c1 = (char) ((ushort) int.Parse("345" ));
Response.Write( c1);

Is your page encoding set to utf-8? (if you put tracing on, at the top of
the trace information it says the encoding).l

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Jonas Åkermark" <jo***@wipcore. se> wrote in message
news:OE******** ******@TK2MSFTN GP14.phx.gbl...
Maybe it is because I'm usning the Server object in a function in a non
web environment - a regular class:

string decodedText = System.Web.Http Context.Current .Server.HtmlDec ode(
text );

where the text property sometimes contains the char ř

Is there some way that I can tell the HtmlDecode which encoding to use?

/Jonas

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
This works fine for me:
Response.Write( Server.HtmlDeco de("ř"));

My web.config specifies:
<globalizatio n requestEncoding ="utf-8" responseEncodin g="utf-8" />

maybe yours is using something else?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Jonas Åkermark" <jo***@wipcore. se> wrote in message
news:uY******** ******@TK2MSFTN GP14.phx.gbl...
Hello!

I have a problem decoding the czech character:
r

The HTML code for this character is ř but when running
Server.HTMLdeco de on that string it just returns ř instead of the
real char. (It works on a lot of other characters)
I need to decode this string in order to render an image with this
character as a part of a headline.

Can anyone help me with this issue, or is it maybe a bug?

/kindest regards, Jonas



Nov 19 '05 #5
Karl Seguin wrote:
This works fine for me:
Response.Write( Server.HtmlDeco de("ř"));

My web.config specifies:
<globalizatio n requestEncoding ="utf-8" responseEncodin g="utf-8" />

maybe yours is using something else?

Karl


Numeric references are based on Unicode code points, thus
requestEncoding and responseEncodin g don't apply.

Cheers,
--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e
Nov 19 '05 #6

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

Similar topics

3
23192
by: b.Wurm | last post by:
how can I write a server.htmlDecode function? thank you
10
8358
by: Danny | last post by:
In the classic asp, I can use escape built-in function (server side function) like this: <script language=javascript> var myContent = unescape(<%=escape(strContent)%>) </script> How do I do that in asp.net? Seems like escape server side function is no longer provided in asp.net, or am I missing something here?
4
2433
by: Sonu Kapoor | last post by:
Hello, does anybody knows the equilant of Server.HtmlDecode when creating a windows service? Thanks, Sonu
3
1458
by: ProJee | last post by:
1. How to pass chr(1) (or another special char below 32) to a method in a webservice? It raises an exception when I try to pass it through webservice.htc 2. How to pass chr(255) It doesn't raise an exception, but another character comes to the server in some cases (different server= different results).. probably some
7
9012
by: jtfaulk | last post by:
I need to encode some information on the server side using ASP.NET with C#; sending via HTTP to a client side application, that needs to be decoded in an MFC C++ application. I'm not sure if I can encode something using: C#: System.Security.Cryptography (to encode) and
15
2576
by: Pucca | last post by:
I'm getting an error when I tried to use this BerConverter class in my C# code. Even though the Interent doc says that it runs on Win2000 sp4, I just thgouth I'll double check. Does anyone know if BerConverter is supported for Win2000 server? http://msdn2.microsoft.com/en-us/library/system.directoryservices.protocols.berconverter.decode.aspx -- Thanks.
8
5344
by: emailmygroup | last post by:
I am trying to decode character ‘#; but it is not working. Anybody knows how to decode this character?
11
13121
by: dan-x | last post by:
I am a novice to SQL Server, so this is probably a really easy problem to fix. I'm translating an Oracle query and need to change the 'decode' to something compatible. Everything I've read points me to using 'case' but no matter how I write it I can't get it to work and get a syntax error. Suggestions? select SYST CTR , isnull(substring(CD_A, 1, 3), ' ') RESCODE , DES DESCRIPTION , decode (substring(CD_A, 1, 3), CODE,PRICE,0)...
3
3790
by: d-fan | last post by:
void decodebio( unsigned char *encbuf, unsigned char * decbuf, int destbuf ) { /* Read Base64 encoded data from standard input and write the decoded data to standard output: */ BIO *b64, *bio ; long i ; char buffer ; memset(buffer, 0, 512) ;
0
10366
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
10173
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
9967
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
7517
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
6750
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
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
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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.