Querystring with accented characters

J

John Byrne

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
 
R

Ray Costanzo [MVP]

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
 
J

John Byrne

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
 
R

Ray Costanzo [MVP]

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
 
J

John Byrne

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
 
E

Evertjan.

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.
 
R

Ray Costanzo [MVP]

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

Ray at home
 
C

Chris Hohmann

John Byrne said:
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
 
J

John Byrne

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
 
C

Chris Hohmann

John Byrne said:
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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top