473,748 Members | 8,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request.QuerySt ring() is stripping out French characters

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=<Ro wID>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.QuerySt ring("QSParamet er"), the value I got is:
"<RowID>Chq ues</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
4 6674
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@discu ssions.microsof t.com]
Posted At: Wednesday, August 31, 2005 2:20 PM
Posted To: microsoft.publi c.dotnet.framew ork.aspnet
Conversation: Request.QuerySt ring() is stripping out French characters
Subject: Request.QuerySt ring() 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=<Ro wID>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.QuerySt ring("QSParamet er"), the value I
got is:
"<RowID>Chq ues</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
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.d e
Nov 19 '05 #3
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èque s</RowID>". However, when the popup window ASPX page's code
behind Page_Load() is called, the call to Request.QuerySt ring() returns
"<RowID>Chq ues</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.d e

Nov 19 '05 #4
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èque s</RowID>". However, when the
popup window ASPX page's code behind Page_Load() is called, the call
to Request.QuerySt ring() returns "<RowID>Chq ues</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.d e
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1661
by: David | last post by:
Hi, I'm trying to pass a querystring with certain common words removed (and, the, if, of etc). The code below replaces the keywords with "" or whatever I choose, but what I'd like to do is remove the words completely from the querystring. How do I remove rather than replace? Thanks *********
0
2713
by: Samuel Fung | last post by:
Hi all, Can ASP retrieve UTF-8 encoded data in query string properly, when used with IIS 5.0 on Windows 2000 Pro/Server? With some trial and error, it seems that adding the directive @CodePage = 65001 to an ASP page makes the ASP page decode UTF-8 data in query string properly. Without the directive, Request.QueryString(var) returns garbled data. With the directive, Request.QueryString(var) decodes UTF-8 encoded data properly. (I tried
4
2883
by: SP | last post by:
Hi I have a problem with a customer's XML being submitting to me in a non-well-format XML. They said that there are 18 other partners who has been able to tweak the XML to make it work. So I guess here is my question, in ASP, when working with XML, how do you handle non-well-formed XML documents on the "listener" response side? Here's the scenerio: Customer post XML Data to us (non-well-formed XML)
10
2198
by: William L. Bahn | last post by:
I'm looking for a few kinds of feedback here. First, there is a program at the end of this post that has a function kgets() that I would like any feedback on - including style. Second, for those that are interested, I present an outline of the approach I am looking at using in class this semester. I would be very interesting in any feedback on that, but if you are not interested, feel free to skip over it.
2
5043
by: Navanith | last post by:
Hi, I wrote a simple aspx page that dumps query string to the browser. Following is the globalization section in web.config <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
6
3812
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length is more that 1249 bytes, then the progress bar of the browser will move too slow and then displaying that the page not found!!!! If the message is less than or equal to 1249 then no problem.
2
5013
by: phl | last post by:
Hello, I have aspx(say page.aspx) page which uses javascript to submit a form reload with some unicode characters,upon an button event e.g page.aspx?param=value I get this value in the codebehind and access it via Request.Querystring property.
0
2823
by: dolittle | last post by:
Hi, I`m using a server that receive a GET request with a query string that contains double-byte non-latin characters: http://www.example.com?%d7%90 and the java code: String queryString = request.getQueryString(); queryString = URLDecoder.decode(queryString, "utf-8");
2
5521
by: Doogie | last post by:
Hi, I'm writing Javascript code to parse out a query string. I want to handle the case where a parameter value may not be sent. So consider a parameter called "State". If the user doesn't pass that in if I do this: var state = <%=Request.QueryString%> This returns an undefined object that I can't seem to do any checks
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.