By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,126 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,126 IT Pros & Developers. It's quick & easy.

Request.QueryString() is stripping out French characters

P: n/a
Lu
Hi, i am currently working on ASP.Net v1.0 and is encountering the following
problem. In javascript, I'm passing in:
"somepage.aspx?QSParameter=<RowID>Chèques</RowID>" as part of the query
string. However, in the code behind when I tried to get the query string
value by calling Request.QueryString("QSParameter"), the value I got is:
"<RowID>Chques</RowID>". The special character "è" has been stripped out.
The web.config file is currently set to use UTF-8 for request, response, and
file encoding. What could be causing characters like "è" to be stripped out
of the query string in the code behind? Do I need to set some other value or
use some special processing code? Thanks.
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Lu:

Open your aspx page and select "Save <<page name>> As..." The Save
button in the dialog should have a down arrow at the right of the
button. Click this and select "Save With Encoding". You will be asked
if you want to overwrite the file. Click Yes to this. You will then
get a dialog asking you to select Endcoding and Line Endings. Leave the
Line Endings alone, but select the "Unicode - Codepage 1200" option and
save the file.

What is happening is VS.NET is saving your aspx file an an ASCII file,
which only has one byte per character and as such cannot support foreign
language character sets. When you save it with encoding, it will save
it as a text file, but it will keep the second Unicode byte with the
file.

John

-----Original Message-----
From: Lu [mailto:Lu@discussions.microsoft.com]
Posted At: Wednesday, August 31, 2005 2:20 PM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Request.QueryString() is stripping out French characters
Subject: Request.QueryString() is stripping out French characters
Hi, i am currently working on ASP.Net v1.0 and is encountering the
following problem. In javascript, I'm passing in:
"somepage.aspx?QSParameter=<RowID>Chques</RowID>" as part of the query
string. However, in the code behind when I tried to get the query
string value by calling Request.QueryString("QSParameter"), the value I
got is:
"<RowID>Chques</RowID>". The special character "" has been stripped
out.
The web.config file is currently set to use UTF-8 for request, response,
and file encoding. What could be causing characters like "" to be
stripped out of the query string in the code behind? Do I need to set
some other value or use some special processing code? Thanks.

Nov 19 '05 #2

P: n/a
John Horst wrote:
Lu:

Open your aspx page and select "Save <<page name>> As..." The Save
button in the dialog should have a down arrow at the right of the
button. Click this and select "Save With Encoding". You will be
asked if you want to overwrite the file. Click Yes to this. You
will then get a dialog asking you to select Endcoding and Line
Endings. Leave the Line Endings alone, but select the "Unicode -
Codepage 1200" option and save the file.
That won't help, but rather be harmful, without changing the
fileEncoding attribute in web.config to UTF-16LE. Since Lu's already
using UTF-8, this is a waste of time. The files must be stored as UTF-8
instead.
What is happening is VS.NET is saving your aspx file an an ASCII file,
which only has one byte per character and as such cannot support
foreign language character sets. When you save it with encoding, it
will save it as a text file, but it will keep the second Unicode byte
with the file.


That's not correct. ASP.NET seems to use the platform's default
encoding if no fileEncoding is specified, just like VS .NET does. I say
"seems", because that behaviour isn't documented.

If that platform default is for example Windows-1252, you can easily
save many special characters used in Western Europe natively in your
source files.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #3

P: n/a
Lu
Hi, for this page, what we do is that we have an XML control on the ASPX
which we use to dynamically create a table based on data returned from our
business objects. This dynamic table that we render contains texts and
numbers that the user can click on to go a pop up that will show more info.
When the user clicks on the link, the javascript grabs the necessary
information from the dynamically render page and pass them as query string
parameters. So, the string "Chèques" is part of the data that is returned
from our business object and dynamically rendered on the screen. The string
is also used in the query string parameter when the user clicks on
appropriate link. What is happening now is that the page renders properly
with the correct text. The javascript is grabbing the correct test and
calling the popup window ASPX page with the correct query string parameter.
So if I put an alert() call in the javascript, I will see
"<RowID>Chèques</RowID>". However, when the popup window ASPX page's code
behind Page_Load() is called, the call to Request.QueryString() returns
"<RowID>Chques</RowID>". In the web.config, I have request, response, and
file encoding set to utf-8. So it seems like somewhere between when the page
is submitted, and the Page_Load() event is fired, the "è" character was
removed for some reason. The ASP.Net project is currently on framework v1.0
and upgrading is not an option currently.

Also, I have Window-1252 character code page installed according to
"Regional and Language Options" in control panel. Not sure how to set it as
the default code page though.

Any ideas or suggestions to solve this problem would be greatly appreciated.
Thanks.

"Joerg Jooss" wrote:
John Horst wrote:
Lu:

Open your aspx page and select "Save <<page name>> As..." The Save
button in the dialog should have a down arrow at the right of the
button. Click this and select "Save With Encoding". You will be
asked if you want to overwrite the file. Click Yes to this. You
will then get a dialog asking you to select Endcoding and Line
Endings. Leave the Line Endings alone, but select the "Unicode -
Codepage 1200" option and save the file.


That won't help, but rather be harmful, without changing the
fileEncoding attribute in web.config to UTF-16LE. Since Lu's already
using UTF-8, this is a waste of time. The files must be stored as UTF-8
instead.
What is happening is VS.NET is saving your aspx file an an ASCII file,
which only has one byte per character and as such cannot support
foreign language character sets. When you save it with encoding, it
will save it as a text file, but it will keep the second Unicode byte
with the file.


That's not correct. ASP.NET seems to use the platform's default
encoding if no fileEncoding is specified, just like VS .NET does. I say
"seems", because that behaviour isn't documented.

If that platform default is for example Windows-1252, you can easily
save many special characters used in Western Europe natively in your
source files.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de

Nov 19 '05 #4

P: n/a
Lu wrote:
Hi, for this page, what we do is that we have an XML control on the
ASPX which we use to dynamically create a table based on data
returned from our business objects. This dynamic table that we
render contains texts and numbers that the user can click on to go a
pop up that will show more info. When the user clicks on the link,
the javascript grabs the necessary information from the dynamically
render page and pass them as query string parameters. So, the string
"Chèques" is part of the data that is returned from our business
object and dynamically rendered on the screen. The string is also
used in the query string parameter when the user clicks on
appropriate link. What is happening now is that the page renders
properly with the correct text. The javascript is grabbing the
correct test and calling the popup window ASPX page with the correct
query string parameter. So if I put an alert() call in the
javascript, I will see "<RowID>Chèques</RowID>". However, when the
popup window ASPX page's code behind Page_Load() is called, the call
to Request.QueryString() returns "<RowID>Chques</RowID>". In the
web.config, I have request, response, and file encoding set to utf-8.
So it seems like somewhere between when the page is submitted, and
the Page_Load() event is fired, the "è" character was removed for
some reason. The ASP.Net project is currently on framework v1.0 and
upgrading is not an option currently.


I guess that the JavaScript code uses a different encoding internally
when fetching the popup page. You could use a debugging proxy like
Fiddler (www.fiddlertool.com) to monitor your HTTP traffic.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.