473,586 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URLEncode Problem from ASP.NET

Hi All:
In my application I am sending the input values through query string from a datagrid template column,I used URLEncode to encode the URL String,
please find the input below, I am facing a problem when the input string contains ® character ,
Here from ASP.NET I am redirecting to the ASP based system,when I give same input from ASP based system, it is showing Microsoft%AE%20 Access%20 ,with this I am getting the correct results, where as when I send it from the ASP.NET with URL Encode it is showing Microsoft%c2%ae +Access, this is not giving any results. Can any one please help me out what to do to get the URL string simillar to I got it in ASP. Is there any different way to handle the encoding when ® character present in the string.


Input:
Microsoft® Access
My Code:
<asp:TemplateCo lumn HeaderText="Sam ple Column">
<ItemTemplate >
<asp:Hyperlin k runat="server" Text='<%#(strin g)DataBinder.Ev al(Container.Da taItem,"Product Name")%>' NavigateUrl='<% # "http://trwork/SMSReporting_TR S/Report.asp?Repo rtID=67&amp;var iable="+Server. UrlEncode((stri ng)DataBinder.E val(Container.D ataItem,"Produc tName"))%>' ID="Hyperlink1 "/>
</ItemTemplate>
</asp:TemplateCol umn>

From ASP URL String :
http://trwork/SMSReporting_TRS/Repor...AE%20Access%20

From ASP.NET URL String:
http://trwork/SMSReporting_TRS/Repor...t%c2%ae+Access

Thanks in Advance


Nov 17 '05 #1
5 2408
"vtreddy" <vt*****@hotmai l.com> wrote in message
news:#O******** ******@tk2msftn gp13.phx.gbl...
Hi All:
In my application I am sending the input values through query string from a datagrid template column,I used URLEncode to
encode the URL String, please find the input below, I am facing a problem when the input string contains ® character , Here from ASP.NET I am redirecting to the ASP based system,when I give same input from ASP based system, it is showing
Microsoft%AE%20 Access%20 ,with this I am getting the correct results, where as when I send it from the ASP.NET with URL Encode it is showing Microsoft%c2%ae +Access, this is not giving any results. Can any one please help me out what to do to get the URL string simillar to I got it in ASP. Is there any different way to handle the encoding when ® character present in the string.


%C2%AE is the UTF-8 encoding for the (R) character. Your ASP page was
probably using CodePage="1252" or something like that, which is a Latin 1
codepage. The (R) character is %AE in that codepage.

To get your ASP.NET page to behave the same way, try setting
Response.Charse t and Response.Conten tEncoding:

Response.Charse t = "iso-8859-1"; // Latin 1
Response.Conten tEncoding = System.Text.Get Encoding(Respon se.Charset);

Another way to fix this is to change the Report.asp page so that it
understands Unicode. This will allow your application to use characters from
more than just the Latin 1 character set. I think you can do this by setting
CodePage="65001 " on your Report.asp page but I'm not sure.

Nov 17 '05 #2
Bret,

Thank you very much for your help, Session.CodePag e = 65001 is commented out in asp based reporting system, when I uncommented the code,It worked fine.

Best Regards,

Thirupathi
"Bret Mulvey [MS]" <br***@online.m icrosoft.com> wrote in message news:gqomb.2202 5$Fm2.11405@att bi_s04...
"vtreddy" <vt*****@hotmai l.com> wrote in message
news:#O******** ******@tk2msftn gp13.phx.gbl...
Hi All:
In my application I am sending the input values through query string from

a datagrid
template column,I used URLEncode to
encode the URL String, please find the input below, I am facing a problem

when the input
string contains ® character , Here from ASP.NET I am redirecting to the

ASP based
system,when I give same input from ASP based system, it is showing
Microsoft%AE%20 Access%20 ,with this I am getting the correct results,

where as when I
send it from the ASP.NET with URL Encode it is showing

Microsoft%c2%ae +Access,
this is not giving any results. Can any one please help me out what to do

to get the URL
string simillar to I got it in ASP. Is there any different way to handle

the encoding when ®
character present in the string.


%C2%AE is the UTF-8 encoding for the (R) character. Your ASP page was
probably using CodePage="1252" or something like that, which is a Latin 1
codepage. The (R) character is %AE in that codepage.

To get your ASP.NET page to behave the same way, try setting
Response.Charse t and Response.Conten tEncoding:

Response.Charse t = "iso-8859-1"; // Latin 1
Response.Conten tEncoding = System.Text.Get Encoding(Respon se.Charset);

Another way to fix this is to change the Report.asp page so that it
understands Unicode. This will allow your application to use characters from
more than just the Latin 1 character set. I think you can do this by setting
CodePage="65001 " on your Report.asp page but I'm not sure.


Nov 17 '05 #3
Bret,

When I Set the CodePage="65001 ", I am getting the results,the Query string is decoded properly, please find below the output, but in the result,it is adding  character before ® character,Could you please let me know, How to encode the string to avoid  here.

Parameters: Microsoft® Access
Computer Name User Name Product Name Company Name Product Version
TRWORK Administrator Microsoft® Access Microsoft Corporation 3.00.0002

Thank you very much for your help.

Thirupathi

"vtreddy" <vt*****@hotmai l.com> wrote in message news:eY******** *****@TK2MSFTNG P09.phx.gbl...
Bret,

Thank you very much for your help, Session.CodePag e = 65001 is commented out in asp based reporting system, when I uncommented the code,It worked fine.

Best Regards,

Thirupathi
"Bret Mulvey [MS]" <br***@online.m icrosoft.com> wrote in message news:gqomb.2202 5$Fm2.11405@att bi_s04...
"vtreddy" <vt*****@hotmai l.com> wrote in message
news:#O******** ******@tk2msftn gp13.phx.gbl...
Hi All:
In my application I am sending the input values through query string from

a datagrid
template column,I used URLEncode to
encode the URL String, please find the input below, I am facing a problem

when the input
string contains ® character , Here from ASP.NET I am redirecting to the

ASP based
system,when I give same input from ASP based system, it is showing
Microsoft%AE%20 Access%20 ,with this I am getting the correct results,

where as when I
send it from the ASP.NET with URL Encode it is showing

Microsoft%c2%ae +Access,
this is not giving any results. Can any one please help me out what to do

to get the URL
string simillar to I got it in ASP. Is there any different way to handle

the encoding when ®
character present in the string.


%C2%AE is the UTF-8 encoding for the (R) character. Your ASP page was
probably using CodePage="1252" or something like that, which is a Latin 1
codepage. The (R) character is %AE in that codepage.

To get your ASP.NET page to behave the same way, try setting
Response.Charse t and Response.Conten tEncoding:

Response.Charse t = "iso-8859-1"; // Latin 1
Response.Conten tEncoding = System.Text.Get Encoding(Respon se.Charset);

Another way to fix this is to change the Report.asp page so that it
understands Unicode. This will allow your application to use characters from
more than just the Latin 1 character set. I think you can do this by setting
CodePage="65001 " on your Report.asp page but I'm not sure.


Nov 17 '05 #4
It's possible that the ASP page is interpreting the string correctly now and
is rendering the page using UTF-8, but the browser is not interpreting the
page as UTF-8. If you're using IE, check to see what "View / Encoding" says
the page is set to. If it's not Unicode, check to see if the page has a
<meta name="content-type" content="text/html; charset=utf-8" /> tag. If it
includes this tag but shows iso-8859-1 or some other charset value, try
changing it to utf-8. You can play with different values of View / Encoding
in the browser to determine which encoding the server actually used for the
page output.
"vtreddy" <vt*****@hotmai l.com> wrote in message
news:uJ******** ******@TK2MSFTN GP12.phx.gbl...
Bret,
When I Set the CodePage="65001 ", I am getting the results,the Query string
is decoded properly, please find below the output, but in the result,it is
adding  character before ® character,Could you please let me know, How to
encode the string to avoid  here.
Parameters: Microsoft® Access
Computer Name User Name Product Name Company Name Product Version
TRWORK Administrator Microsoft® Access Microsoft Corporation
3.00.0002
Thank you very much for your help.
Thirupathi
"vtreddy" <vt*****@hotmai l.com> wrote in message
news:eY******** *****@TK2MSFTNG P09.phx.gbl...
Bret,

Thank you very much for your help, Session.CodePag e = 65001 is commented out
in asp based reporting system, when I uncommented the code,It worked fine.

Best Regards,

Thirupathi
"Bret Mulvey [MS]" <br***@online.m icrosoft.com> wrote in message
news:gqomb.2202 5$Fm2.11405@att bi_s04...
"vtreddy" <vt*****@hotmai l.com> wrote in message
news:#O******** ******@tk2msftn gp13.phx.gbl...
Hi All:
In my application I am sending the input values through query string
from a datagrid
template column,I used URLEncode to
encode the URL String, please find the input below, I am facing a
problem when the input
string contains ® character , Here from ASP.NET I am redirecting to the ASP based
system,when I give same input from ASP based system, it is showing
Microsoft%AE%20 Access%20 ,with this I am getting the correct results,

where as when I
send it from the ASP.NET with URL Encode it is showing

Microsoft%c2%ae +Access,
this is not giving any results. Can any one please help me out what to

do to get the URL
string simillar to I got it in ASP. Is there any different way to handle the encoding when ®
character present in the string.


%C2%AE is the UTF-8 encoding for the (R) character. Your ASP page was
probably using CodePage="1252" or something like that, which is a Latin 1
codepage. The (R) character is %AE in that codepage.

To get your ASP.NET page to behave the same way, try setting
Response.Charse t and Response.Conten tEncoding:

Response.Charse t = "iso-8859-1"; // Latin 1
Response.Conten tEncoding = System.Text.Get Encoding(Respon se.Charset);

Another way to fix this is to change the Report.asp page so that it
understands Unicode. This will allow your application to use characters

from more than just the Latin 1 character set. I think you can do this by setting CodePage="65001 " on your Report.asp page but I'm not sure.

Nov 17 '05 #5
Bret,
I changed to utf-8, it is displaying the results correctly,
Thank you very much for your help,
Best Regards,
Thirupathi
"Bret Mulvey [MS]" <br***@online.m icrosoft.com> wrote in message
news:VABmb.1321 9$mZ5.76921@att bi_s54...
It's possible that the ASP page is interpreting the string correctly now and is rendering the page using UTF-8, but the browser is not interpreting the
page as UTF-8. If you're using IE, check to see what "View / Encoding" says the page is set to. If it's not Unicode, check to see if the page has a
<meta name="content-type" content="text/html; charset=utf-8" /> tag. If it includes this tag but shows iso-8859-1 or some other charset value, try
changing it to utf-8. You can play with different values of View / Encoding in the browser to determine which encoding the server actually used for the page output.
"vtreddy" <vt*****@hotmai l.com> wrote in message
news:uJ******** ******@TK2MSFTN GP12.phx.gbl...
Bret,
When I Set the CodePage="65001 ", I am getting the results,the Query string is decoded properly, please find below the output, but in the result,it is
adding  character before ® character,Could you please let me know, How to
encode the string to avoid  here.
Parameters: Microsoft® Access
Computer Name User Name Product Name Company Name Product Version TRWORK Administrator Microsoft® Access Microsoft Corporation
3.00.0002
Thank you very much for your help.
Thirupathi
"vtreddy" <vt*****@hotmai l.com> wrote in message
news:eY******** *****@TK2MSFTNG P09.phx.gbl...
Bret,

Thank you very much for your help, Session.CodePag e = 65001 is commented out in asp based reporting system, when I uncommented the code,It worked fine.

Best Regards,

Thirupathi
"Bret Mulvey [MS]" <br***@online.m icrosoft.com> wrote in message
news:gqomb.2202 5$Fm2.11405@att bi_s04...
"vtreddy" <vt*****@hotmai l.com> wrote in message
news:#O******** ******@tk2msftn gp13.phx.gbl...
Hi All:
In my application I am sending the input values through query string from
a datagrid
template column,I used URLEncode to
encode the URL String, please find the input below, I am facing a

problem
when the input
string contains ® character , Here from ASP.NET I am redirecting to

the ASP based
system,when I give same input from ASP based system, it is showing
Microsoft%AE%20 Access%20 ,with this I am getting the correct results,

where as when I
send it from the ASP.NET with URL Encode it is showing

Microsoft%c2%ae +Access,
this is not giving any results. Can any one please help me out what to do
to get the URL
string simillar to I got it in ASP. Is there any different way to

handle the encoding when ®
character present in the string.


%C2%AE is the UTF-8 encoding for the (R) character. Your ASP page was
probably using CodePage="1252" or something like that, which is a Latin 1 codepage. The (R) character is %AE in that codepage.

To get your ASP.NET page to behave the same way, try setting
Response.Charse t and Response.Conten tEncoding:

Response.Charse t = "iso-8859-1"; // Latin 1
Response.Conten tEncoding = System.Text.Get Encoding(Respon se.Charset);

Another way to fix this is to change the Report.asp page so that it
understands Unicode. This will allow your application to use characters

from
more than just the Latin 1 character set. I think you can do this by

setting
CodePage="65001 " on your Report.asp page but I'm not sure.


Nov 17 '05 #6

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

Similar topics

3
28397
by: Joshua Beall | last post by:
Hi All, I can see from the manual that the difference between urlencode and rawurlencode is that urlencode translates spaces to '+' characters, whereas rawurlencode translates it into it's hex code. My question is, is there any real world difference between these two functions? Or perhaps another way of asking the question: *why* are...
3
5147
by: George Hester | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en-us;301464 Look down at the MyPage.asp example. You will see that Microsoft does this: 'Costruct the URL for the current page s = "http://" s = s & Request.ServerVariables("HTTP_HOST") s = s & Request.ServerVariables("URL") If Request.QueryString.Count > 0 Then s = s & "?" &...
3
7634
by: JP SIngh | last post by:
Hi All I have users who upload files using my application using ASPUPLOAD component. My code uploads the file to a network location and once the upload is finish I display the hyperlink using the following code <a href=\myserver\attachments\<%=server.urlencode(rs("FileName"))%> target="_blank" ><%=rs("Filename")%>
1
3762
by: yawnmoth | last post by:
Any ideas as to why urlencode(addslashes(chr(0))) returns '%5C0'? It seems like it should return '%00' since that's what urlencode(chr(0)) returns. If not that, I could also see it returning '%5C%00' since that's what urlencode('\\').urlencode(chr(0)) and urlencode('\\'.chr(0)) return. '%5C0', however, confuses me. Even...
1
4999
by: Jim | last post by:
Hello, I'm trying to do urllib.urlencode() with unicode correctly, and I wonder if some kind person could set me straight? My understanding is that I am supposed to be able to urlencode anything up to the top half of latin-1 -- decimal 128-255. I can't just send urlencode a unicode character:
4
6731
by: Andreas Klemt | last post by:
Hello, is there a difference between System.Web.HttpUtility.UrlEncode and Server.UrlEncode ?
1
5362
by: Dario Sala | last post by:
Hi, what's the difference about Asp Server.UrlEncode and the Asp.Net Server.UrlEncode ? In asp: Server.UrlEncode("*") = %2A In Asp.Net: Server.UrlEncode("*") = *
0
1201
by: Nathan Sokalski | last post by:
I am using Server.UrlEncode to make a piece of data safe to use as a QueryString. The data I am using is as follows: ratedpoem("title") Which returns the following String: "An Expression I Can't Show"
12
4912
by: sleytr | last post by:
Hi, I'm trying to make a gui for a web service. Site using ± character in value of some fields. But I can't encode this character properly. >>> data = {'key':'±'} >>> urllib.urlencode(data) 'key=%C2%B1' but it should be only %B1 not %C2%B1. where is this %C2 coming from?
6
3876
by: CindyH | last post by:
Hi I'm not sure whether I should send this as a new message or use the one I've been using but... I'm using vb.net 2.0 - My problem is I need to send something like this: 'dim encodedstring = "test=" + httputility.urlencode(doc.outerxml)' as a http xml post and then need to receive it on other end for a test. It needs to be sent as a...
0
7911
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8200
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. ...
0
8338
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...
1
7954
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
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...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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

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.