473,395 Members | 2,222 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,395 software developers and data experts.

Server.HTMLDecode 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.HTMLdecode 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 3503
This works fine for me:
Response.Write(Server.HtmlDecode("ř"));

My web.config specifies:
<globalization requestEncoding="utf-8" responseEncoding="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**************@TK2MSFTNGP14.phx.gbl...
Hello!

I have a problem decoding the czech character:
r

The HTML code for this character is ř but when running
Server.HTMLdecode 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.HttpContext.Current.Server.HtmlDecode(
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****************@TK2MSFTNGP10.phx.gbl...
This works fine for me:
Response.Write(Server.HtmlDecode("ř"));

My web.config specifies:
<globalization requestEncoding="utf-8" responseEncoding="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**************@TK2MSFTNGP14.phx.gbl...
Hello!

I have a problem decoding the czech character:
r

The HTML code for this character is ř but when running
Server.HTMLdecode 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.HttpUtility.HtmlDecode 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**************@TK2MSFTNGP14.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.HttpContext.Current.Server.HtmlDecode(
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****************@TK2MSFTNGP10.phx.gbl...
This works fine for me:
Response.Write(Server.HtmlDecode("ř"));

My web.config specifies:
<globalization requestEncoding="utf-8" responseEncoding="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**************@TK2MSFTNGP14.phx.gbl...
Hello!

I have a problem decoding the czech character:
r

The HTML code for this character is ř but when running
Server.HTMLdecode 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(string decodedText)
{
string tmpResult = decodedText;
bool found = true;
try
{
while(found)
{
if( tmpResult.IndexOf("&#") > -1 )
{
string chars = tmpResult.Substring( tmpResult.IndexOf("&#")+2, 3);
//decode
char c1 = (char) ((ushort) int.Parse(chars));
tmpResult = tmpResult.Replace("&#" + chars + ";", c1.ToString());
}
else
{
found = false;
}
}
}
catch{}

return tmpResult;
}
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:e2**************@TK2MSFTNGP10.phx.gbl...
i don't think that's your problem (although within a class, there's no
reason not to use System.Web.HttpUtility.HtmlDecode 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**************@TK2MSFTNGP14.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.HttpContext.Current.Server.HtmlDecode(
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****************@TK2MSFTNGP10.phx.gbl...
This works fine for me:
Response.Write(Server.HtmlDecode("ř"));

My web.config specifies:
<globalization requestEncoding="utf-8" responseEncoding="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**************@TK2MSFTNGP14.phx.gbl...
Hello!

I have a problem decoding the czech character:
r

The HTML code for this character is ř but when running
Server.HTMLdecode 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.HtmlDecode("ř"));

My web.config specifies:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

maybe yours is using something else?

Karl


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

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

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

Similar topics

3
by: b.Wurm | last post by:
how can I write a server.htmlDecode function? thank you
10
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...
4
by: Sonu Kapoor | last post by:
Hello, does anybody knows the equilant of Server.HtmlDecode when creating a windows service? Thanks, Sonu
3
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...
7
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...
15
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...
8
by: emailmygroup | last post by:
I am trying to decode character ‘#; but it is not working. Anybody knows how to decode this character?
11
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...
3
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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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.