For Programmers: Free Programming Magazines  


Home > Archive > ASP > December 2004 > Querystring with accented characters









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Querystring with accented characters
John Byrne

2004-12-17, 3:55 am

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]

2004-12-17, 3:55 am

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" <JohnByrne@discussions.microsoft.com> wrote in message
news:1F0C8AF5-6C7C-4F8B-B426-C9962EDBF0A2@microsoft.com...
>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

2004-12-17, 3:55 am

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" <JohnByrne@discussions.microsoft.com> wrote in message
> news:1F0C8AF5-6C7C-4F8B-B426-C9962EDBF0A2@microsoft.com...
>
>
>

Ray Costanzo [MVP]

2004-12-17, 3:55 pm



"John Byrne" <JohnByrne@discussions.microsoft.com> wrote in message
news:D27E2B2F-4520-46BD-B92A-22F0B40D469A@microsoft.com...

> 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

2004-12-20, 3:55 am

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" <JohnByrne@discussions.microsoft.com> wrote in message
> news:D27E2B2F-4520-46BD-B92A-22F0B40D469A@microsoft.com...
>
> 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]

2004-12-20, 3:55 am

If you don't want answers, don't ask questions.

Ray at home

"John Byrne" <JohnByrne@discussions.microsoft.com> wrote in message
news:14BA46D0-5D81-4925-BBA1-D661DEB40847@microsoft.com...[color=darkred]
> 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:
>


Evertjan.

2004-12-20, 8:55 am

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]

2004-12-20, 3:55 pm

No, it's the people that are the joy of usenet. Also top-posting. ;]

Ray at home

"Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
news:Xns95C559C356EABeejj99@194.109.133.29...
> Ray Costanzo [MVP] wrote on 20 dec 2004 in
> microsoft.public.inetserver.asp.general:
>
> 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)



Chris Hohmann

2004-12-20, 8:55 pm

"John Byrne" <JohnByrne@discussions.microsoft.com> wrote in message
news:14BA46D0-5D81-4925-BBA1-D661DEB40847@microsoft.com...
> "Ray Costanzo [MVP]" wrote:
If[color=darkred]
but[color=darkred]
> 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/libra...bom_resopcp.asp



John Byrne

2004-12-20, 8:55 pm

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" <JohnByrne@discussions.microsoft.com> wrote in message
> news:14BA46D0-5D81-4925-BBA1-D661DEB40847@microsoft.com...
> If
> but
>
> 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/libra...bom_resopcp.asp
>
>
>
>

Chris Hohmann

2004-12-20, 8:55 pm


"John Byrne" <JohnByrne@discussions.microsoft.com> wrote in message
news:5121BFBB-EDE3-4689-BFAC-EA833539F187@microsoft.com...
> "Chris Hohmann" wrote:
>
view-source?[color=darkred]
problem,[color=darkred]
?parm=AAà[color=darkred]
I[color=darkred]
some[color=darkred]
are[color=darkred]
set[color=darkred]
enabled,[color=darkred]
page.[color=darkred]
not[color=darkred]
http://www.msdn.microsoft.com/libra...bom_resopcp.asp[color=darkred]
> 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/...ts/charset4.asp


Also, did you check what the character encoding setting was in your browser?


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com