URLEncode Problem from ASP.NET

Discussion in 'ASP .Net Datagrid Control' started by vtreddy, Oct 25, 2003.

  1. vtreddy

    vtreddy Guest

    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%20Access%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:TemplateColumn HeaderText="Sample Column">
    <ItemTemplate>
    <asp:Hyperlink runat="server" Text='<%#(string)DataBinder.Eval(Container.DataItem,"ProductName")%>' NavigateUrl='<%# "http://trwork/SMSReporting_TRS/Report.asp?ReportID=67&amp;variable="+Server.UrlEncode((string)DataBinder.Eval(Container.DataItem,"ProductName"))%>' ID="Hyperlink1"/>
    </ItemTemplate>
    </asp:TemplateColumn>

    From ASP URL String :
    http://trwork/SMSReporting_TRS/Report.asp?ReportID=67&variable=Microsoft%AE%20Access%20

    From ASP.NET URL String:
    http://trwork/SMSReporting_TRS/Report.asp?ReportID=67&variable=Microsoft® Access

    Thanks in Advance
    vtreddy, Oct 25, 2003
    #1
    1. Advertising

  2. "vtreddy" <> wrote in message
    news:#...

    > 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%20Access%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.Charset and Response.ContentEncoding:

    Response.Charset = "iso-8859-1"; // Latin 1
    Response.ContentEncoding = System.Text.GetEncoding(Response.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.
    Bret Mulvey [MS], Oct 25, 2003
    #2
    1. Advertising

  3. vtreddy

    vtreddy Guest

    Bret,

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

    Best Regards,

    Thirupathi


    "Bret Mulvey [MS]" <> wrote in message news:gqomb.22025$Fm2.11405@attbi_s04...
    > "vtreddy" <> wrote in message
    > news:#...
    >
    > > 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%20Access%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.Charset and Response.ContentEncoding:
    >
    > Response.Charset = "iso-8859-1"; // Latin 1
    > Response.ContentEncoding = System.Text.GetEncoding(Response.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.
    >
    >
    >
    vtreddy, Oct 25, 2003
    #3
  4. vtreddy

    vtreddy Guest

    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" <> wrote in message news:...
    Bret,

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

    Best Regards,

    Thirupathi


    "Bret Mulvey [MS]" <> wrote in message news:gqomb.22025$Fm2.11405@attbi_s04...
    > "vtreddy" <> wrote in message
    > news:#...
    >
    > > 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%20Access%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.Charset and Response.ContentEncoding:
    >
    > Response.Charset = "iso-8859-1"; // Latin 1
    > Response.ContentEncoding = System.Text.GetEncoding(Response.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.
    >
    >
    >
    vtreddy, Oct 25, 2003
    #4
  5. 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" <> wrote in message
    news:...
    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" <> wrote in message
    news:...
    Bret,

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

    Best Regards,

    Thirupathi


    "Bret Mulvey [MS]" <> wrote in message
    news:gqomb.22025$Fm2.11405@attbi_s04...
    > "vtreddy" <> wrote in message
    > news:#...
    >
    > > 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%20Access%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.Charset and Response.ContentEncoding:
    >
    > Response.Charset = "iso-8859-1"; // Latin 1
    > Response.ContentEncoding = System.Text.GetEncoding(Response.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.
    >
    >
    >
    Bret Mulvey [MS], Oct 25, 2003
    #5
  6. vtreddy

    vtreddy Guest

    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]" <> wrote in message
    news:VABmb.13219$mZ5.76921@attbi_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" <> wrote in message
    > news:...
    > 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" <> wrote in message
    > news:...
    > Bret,
    >
    > Thank you very much for your help, Session.CodePage = 65001 is commented

    out
    > in asp based reporting system, when I uncommented the code,It worked fine.
    >
    > Best Regards,
    >
    > Thirupathi
    >
    >
    > "Bret Mulvey [MS]" <> wrote in message
    > news:gqomb.22025$Fm2.11405@attbi_s04...
    > > "vtreddy" <> wrote in message
    > > news:#...
    > >
    > > > 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%20Access%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.Charset and Response.ContentEncoding:
    > >
    > > Response.Charset = "iso-8859-1"; // Latin 1
    > > Response.ContentEncoding = System.Text.GetEncoding(Response.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.
    > >
    > >
    > >

    >
    >
    vtreddy, Oct 25, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vtreddy

    URLEncode Problem from ASP.NET

    vtreddy, Oct 25, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    5,668
    vtreddy
    Oct 25, 2003
  2. Andreas Klemt
    Replies:
    4
    Views:
    10,257
    mikeb
    Jan 22, 2004
  3. Liorm
    Replies:
    0
    Views:
    373
    Liorm
    Jan 30, 2004
  4. sviau

    urlencode and asp.net

    sviau, Feb 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,642
    Steven Cheng[MSFT]
    Feb 10, 2004
  5. Dario Sala
    Replies:
    1
    Views:
    3,774
    Karl Seguin
    Nov 15, 2004
Loading...

Share This Page