Querystring with accented characters

Discussion in 'ASP General' started by John Byrne, Dec 17, 2004.

  1. John Byrne

    John Byrne Guest

    I have encountered a problem when certain European characters are included in
    the Querystring of an URL.

    If I have a URL like: ?param=AAà

    On the receiving page a simple Request() call returns "AA" and not "AAà".

    It drops all accented characters!

    If I change to use a Form instead, it works OK.

    If I copy the Request.QueryString to a String variable and split it I manage
    to get the proper value.

    I have tried this on Windows 2000 and Windows 2003 with the same result.

    Is this a known bug with Request.QueryString? And if so is there a
    fix/workaround??

    Thanks

    John Byrne
    Australia
     
    John Byrne, Dec 17, 2004
    #1
    1. Advertising

  2. No issues on my end. Have you tried a different browser? Does it appear
    right in a view-source? Have you tried URLEncoding it?

    Ray at home


    "John Byrne" <> wrote in message
    news:...
    >I have encountered a problem when certain European characters are included
    >in
    > the Querystring of an URL.
    >
    > If I have a URL like: ?param=AAÃ
    >
    > On the receiving page a simple Request() call returns "AA" and not "AAÃ ".
    >
    > It drops all accented characters!
    >
    > If I change to use a Form instead, it works OK.
    >
    > If I copy the Request.QueryString to a String variable and split it I
    > manage
    > to get the proper value.
    >
    > I have tried this on Windows 2000 and Windows 2003 with the same result.
    >
    > Is this a known bug with Request.QueryString? And if so is there a
    > fix/workaround??
    >
    > Thanks
    >
    > John Byrne
    > Australia
     
    Ray Costanzo [MVP], Dec 17, 2004
    #2
    1. Advertising

  3. John Byrne

    John Byrne Guest

    This is an ASP Request object problem. Different browser makes no difference.

    Getting parameters on the server side behaves differently depending on how
    the ASP page was requested.

    It works as expected when a form is submitted, but if the page is requested
    via URL then Request("<parm>") doesn't return accented characters.

    Thanks

    "Ray Costanzo [MVP]" wrote:

    > No issues on my end. Have you tried a different browser? Does it appear
    > right in a view-source? Have you tried URLEncoding it?
    >
    > Ray at home
    >
    >
    > "John Byrne" <> wrote in message
    > news:...
    > >I have encountered a problem when certain European characters are included
    > >in
    > > the Querystring of an URL.
    > >
    > > If I have a URL like: ?param=AAÃ
    > >
    > > On the receiving page a simple Request() call returns "AA" and not "AAÃ ".
    > >
    > > It drops all accented characters!
    > >
    > > If I change to use a Form instead, it works OK.
    > >
    > > If I copy the Request.QueryString to a String variable and split it I
    > > manage
    > > to get the proper value.
    > >
    > > I have tried this on Windows 2000 and Windows 2003 with the same result.
    > >
    > > Is this a known bug with Request.QueryString? And if so is there a
    > > fix/workaround??
    > >
    > > Thanks
    > >
    > > John Byrne
    > > Australia

    >
    >
    >
     
    John Byrne, Dec 17, 2004
    #3
  4. "John Byrne" <> wrote in message
    news:D...

    > This is an ASP Request object problem. Different browser makes no

    difference.

    Not necessarily.

    Did you miss the part where I asked if the à appears in a view-source? If
    so, it's a browser problem. I'm not saying that this is the problem, but
    it'd help to rule it out...

    Ray at work
     
    Ray Costanzo [MVP], Dec 17, 2004
    #4
  5. John Byrne

    John Byrne Guest

    This is certainly a server-side issue. If the URL for a page is ?parm=AAà

    and the ASP page did:

    Response.Write(Request.QueryString);

    you get:

    parm=AAà

    but if you did:

    Response.Write(Request("parm"));

    you get:

    AA

    but works fine if page invoke via a form (either post or get)

    JB

    "Ray Costanzo [MVP]" wrote:

    >
    >
    > "John Byrne" <> wrote in message
    > news:D...
    >
    > > This is an ASP Request object problem. Different browser makes no

    > difference.
    >
    > Not necessarily.
    >
    > Did you miss the part where I asked if the à appears in a view-source? If
    > so, it's a browser problem. I'm not saying that this is the problem, but
    > it'd help to rule it out...
    >
    > Ray at work
    >
    >
    >
     
    John Byrne, Dec 20, 2004
    #5
  6. If you don't want answers, don't ask questions.

    Ray at home

    "John Byrne" <> wrote in message
    news:...
    > This is certainly a server-side issue. If the URL for a page is ?parm=AAÃ
    >
    > and the ASP page did:
    >
    > Response.Write(Request.QueryString);
    >
    > you get:
    >
    > parm=AAÃ
    >
    > but if you did:
    >
    > Response.Write(Request("parm"));
    >
    > you get:
    >
    > AA
    >
    > but works fine if page invoke via a form (either post or get)
    >
    > JB
    >
    > "Ray Costanzo [MVP]" wrote:
    >
    >>
    >>
    >> "John Byrne" <> wrote in message
    >> news:D...
    >>
    >> > This is an ASP Request object problem. Different browser makes no

    >> difference.
    >>
    >> Not necessarily.
    >>
    >> Did you miss the part where I asked if the à appears in a view-source?
    >> If
    >> so, it's a browser problem. I'm not saying that this is the problem, but
    >> it'd help to rule it out...
    >>
    >> Ray at work
    >>
    >>
    >>
     
    Ray Costanzo [MVP], Dec 20, 2004
    #6
  7. John Byrne

    Evertjan. Guest

    Ray Costanzo [MVP] wrote on 20 dec 2004 in
    microsoft.public.inetserver.asp.general:
    > If you don't want answers, don't ask questions.


    I didn't ask, I still like to read the answers.

    That is the joy of usenet.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Dec 20, 2004
    #7
  8. No, it's the people that are the joy of usenet. Also top-posting. ;]

    Ray at home

    "Evertjan." <> wrote in message
    news:Xns95C559C356EABeejj99@194.109.133.29...
    > Ray Costanzo [MVP] wrote on 20 dec 2004 in
    > microsoft.public.inetserver.asp.general:
    >> If you don't want answers, don't ask questions.

    >
    > I didn't ask, I still like to read the answers.
    >
    > That is the joy of usenet.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    Ray Costanzo [MVP], Dec 20, 2004
    #8
  9. "John Byrne" <> wrote in message
    news:...
    > "Ray Costanzo [MVP]" wrote:
    > > "John Byrne" <> wrote in message
    > > news:D...
    > >
    > > > This is an ASP Request object problem. Different browser makes no

    > > difference.
    > >
    > > Not necessarily.
    > >
    > > Did you miss the part where I asked if the à appears in a view-source?

    If
    > > so, it's a browser problem. I'm not saying that this is the problem,

    but
    > > it'd help to rule it out...
    > >
    > > Ray at work
    > >

    > This is certainly a server-side issue. If the URL for a page is ?parm=AAà
    >
    > and the ASP page did:
    >
    > Response.Write(Request.QueryString);
    >
    > you get:
    >
    > parm=AAà
    >
    > but if you did:
    >
    > Response.Write(Request("parm"));
    >
    > you get:
    >
    > AA
    >
    > but works fine if page invoke via a form (either post or get)
    >
    > JB


    Actually, it's probablly a combination of both client and server issues. I
    believe the problem is associated with the character encoding. Here are some
    things to check:

    1. In your browser, what character encoding are you using?
    2. On the server, what codepage/character encoding are being used. There are
    quite a few places where codepage can be set. Here's an excerpt from the
    Response.CodePage documentation that describes how the codepage setting
    cascades:

    If Response.CodePage is not explicitly set in a page, it is implicitly set
    by Session.CodePage, if sessions are enabled. If sessions are not enabled,
    Response.CodePage is set by @CodePage, if @CodePage is present in the page.
    If there is no @CodePage in the page, Response.CodePage is set by the
    AspCodePage metabase property. If the AspCodePage metabase property is not
    set, or set to 0, Response.CodePage is set by the system ANSI codepage.

    Here's a link to the documentation:
    http://www.msdn.microsoft.com/library/en-us/iissdk/iis/ref_vbom_resopcp.asp
     
    Chris Hohmann, Dec 20, 2004
    #9
  10. John Byrne

    John Byrne Guest

    Thanks for your informative reply.

    Initially the ASP pages had a charset of windows-1252 and the
    Session.CodePage was 65001. I then went and changed all pages to use charset
    UTF-8, but the problem still persisted.

    I have also tried saving the ASP pages in UTF-8 format instead of the normal
    ANSI encoding, but this also had no affect.

    The work-around I had to come up with was create a function that would parse
    the QueryString and return the requested parameter.

    Thanks

    "Chris Hohmann" wrote:

    > "John Byrne" <> wrote in message
    > news:...
    > > "Ray Costanzo [MVP]" wrote:
    > > > "John Byrne" <> wrote in message
    > > > news:D...
    > > >
    > > > > This is an ASP Request object problem. Different browser makes no
    > > > difference.
    > > >
    > > > Not necessarily.
    > > >
    > > > Did you miss the part where I asked if the à appears in a view-source?

    > If
    > > > so, it's a browser problem. I'm not saying that this is the problem,

    > but
    > > > it'd help to rule it out...
    > > >
    > > > Ray at work
    > > >

    > > This is certainly a server-side issue. If the URL for a page is ?parm=AAà
    > >
    > > and the ASP page did:
    > >
    > > Response.Write(Request.QueryString);
    > >
    > > you get:
    > >
    > > parm=AAà
    > >
    > > but if you did:
    > >
    > > Response.Write(Request("parm"));
    > >
    > > you get:
    > >
    > > AA
    > >
    > > but works fine if page invoke via a form (either post or get)
    > >
    > > JB

    >
    > Actually, it's probablly a combination of both client and server issues. I
    > believe the problem is associated with the character encoding. Here are some
    > things to check:
    >
    > 1. In your browser, what character encoding are you using?
    > 2. On the server, what codepage/character encoding are being used. There are
    > quite a few places where codepage can be set. Here's an excerpt from the
    > Response.CodePage documentation that describes how the codepage setting
    > cascades:
    >
    > If Response.CodePage is not explicitly set in a page, it is implicitly set
    > by Session.CodePage, if sessions are enabled. If sessions are not enabled,
    > Response.CodePage is set by @CodePage, if @CodePage is present in the page.
    > If there is no @CodePage in the page, Response.CodePage is set by the
    > AspCodePage metabase property. If the AspCodePage metabase property is not
    > set, or set to 0, Response.CodePage is set by the system ANSI codepage.
    >
    > Here's a link to the documentation:
    > http://www.msdn.microsoft.com/library/en-us/iissdk/iis/ref_vbom_resopcp.asp
    >
    >
    >
    >
     
    John Byrne, Dec 20, 2004
    #10
  11. "John Byrne" <> wrote in message
    news:...
    > "Chris Hohmann" wrote:
    >
    > > "John Byrne" <> wrote in message
    > > news:...
    > > > "Ray Costanzo [MVP]" wrote:
    > > > > "John Byrne" <> wrote in message
    > > > > news:D...
    > > > >
    > > > > > This is an ASP Request object problem. Different browser makes no
    > > > > difference.
    > > > >
    > > > > Not necessarily.
    > > > >
    > > > > Did you miss the part where I asked if the à appears in a

    view-source?
    > > If
    > > > > so, it's a browser problem. I'm not saying that this is the

    problem,
    > > but
    > > > > it'd help to rule it out...
    > > > >
    > > > > Ray at work
    > > > >
    > > > This is certainly a server-side issue. If the URL for a page is

    ?parm=AAà
    > > >
    > > > and the ASP page did:
    > > >
    > > > Response.Write(Request.QueryString);
    > > >
    > > > you get:
    > > >
    > > > parm=AAà
    > > >
    > > > but if you did:
    > > >
    > > > Response.Write(Request("parm"));
    > > >
    > > > you get:
    > > >
    > > > AA
    > > >
    > > > but works fine if page invoke via a form (either post or get)
    > > >
    > > > JB

    > >
    > > Actually, it's probablly a combination of both client and server issues.

    I
    > > believe the problem is associated with the character encoding. Here are

    some
    > > things to check:
    > >
    > > 1. In your browser, what character encoding are you using?
    > > 2. On the server, what codepage/character encoding are being used. There

    are
    > > quite a few places where codepage can be set. Here's an excerpt from the
    > > Response.CodePage documentation that describes how the codepage setting
    > > cascades:
    > >
    > > If Response.CodePage is not explicitly set in a page, it is implicitly

    set
    > > by Session.CodePage, if sessions are enabled. If sessions are not

    enabled,
    > > Response.CodePage is set by @CodePage, if @CodePage is present in the

    page.
    > > If there is no @CodePage in the page, Response.CodePage is set by the
    > > AspCodePage metabase property. If the AspCodePage metabase property is

    not
    > > set, or set to 0, Response.CodePage is set by the system ANSI codepage.
    > >
    > > Here's a link to the documentation:
    > >

    http://www.msdn.microsoft.com/library/en-us/iissdk/iis/ref_vbom_resopcp.asp
    > >
    > >

    > Thanks for your informative reply.
    >
    > Initially the ASP pages had a charset of windows-1252 and the
    > Session.CodePage was 65001. I then went and changed all pages to use

    charset
    > UTF-8, but the problem still persisted.
    >
    > I have also tried saving the ASP pages in UTF-8 format instead of the

    normal
    > ANSI encoding, but this also had no affect.
    >
    > The work-around I had to come up with was create a function that would

    parse
    > the QueryString and return the requested parameter.
    >
    > Thanks
    >


    CodePage 65001 is associated with UTF-8, not Windows-1252. Here's a link to
    the characterset/codepage table referenced in the Response.CodePage
    documentation:
    http://msdn.microsoft.com/workshop/author/dhtml/reference/charsets/charset4.asp


    Also, did you check what the character encoding setting was in your browser?
     
    Chris Hohmann, Dec 21, 2004
    #11
    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. Mickey Segal

    Text search with accented characters

    Mickey Segal, Dec 15, 2005, in forum: Java
    Replies:
    3
    Views:
    801
    Roedy Green
    Dec 16, 2005
  2. Davide Benini

    accented characters

    Davide Benini, Jun 1, 2005, in forum: XML
    Replies:
    4
    Views:
    826
    David Carlisle
    Jun 1, 2005
  3. Mark Drummond

    Dealing with accented characters

    Mark Drummond, May 31, 2006, in forum: Perl
    Replies:
    0
    Views:
    2,928
    Mark Drummond
    May 31, 2006
  4. Fuzzyman

    Problems With Accented Characters

    Fuzzyman, Feb 22, 2004, in forum: Python
    Replies:
    1
    Views:
    408
    Fuzzyman
    Feb 23, 2004
  5. Stephen Boulet
    Replies:
    3
    Views:
    411
    Terry Reedy
    Jul 16, 2004
Loading...

Share This Page