473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Request object does not handle globalization?

Assume you have a simple HTML form that submits its form results to a .aspx
page. The receiving .aspx page processes the values sent by the form. If
the form data contains an accented character (ex., Ángel with an accent over
"A"), the REQUEST object appears to loose the globalization, and nukes any
extended ascii characters. Is there a way to avoid this? In the examples
below, the resulting string is "ngel", without the A and accent.
Suggestions?

string myKey = "Name";
string Test0 = Request.Form.Get(myKey);
string Test1 = Request[myKey];
string Test2 = Request[myKey].ToString(CultureInfo.CurrentCulture);
string Test3 = Request[myKey].ToString(CultureInfo.InvariantCulture);

In the web.config, all the defaults remain including:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

For those of you wondering why we do this, we have non-technical staff
members that create HTML forms. They all redirect to a .NET application
that handles the routing/logging in a consistent way. However, it appears
to be dropping all extended ascii characters. Neat.

Feb 6 '06 #1
1 1728
Hello Mark,

Welcome to the ASPNET newsgroup.

From your description, I understand you have some normal html pages which
will post some text data to some other ASP.NET web pages. The posted text
data contains some non-ascii chars and you found that those chars are not
handled correctly in the asp.net web pages, correct?

Based on my experience, this problem is likely caused by the html form text
data (sent to the asp.net page) is not encoded as utf-8 charset encoding.
For the ASP.NET web pages, since the web.config file has configured
request/response to use utf-8 encoding, if other charset/encoding text is
posted, the asp.net runtime will fail to correctly parse them.

What's the client machine's system locale setting, generally this will
affect the html page's text encoding because html or other text file is
saved as local machine's system locale's encoding(charset). Also, I suggest
you save that test html page as "utf-8" through notepad or any other text
editor and retest it in browser to see whether it can correctly post those
non-asscii chars to asp.net page.

If there is anything unclear or if you have any other question, please feel
free to let me know.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 7 '06 #2

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

Similar topics

4
by: Gerhard Pretorius | last post by:
ON Win 2003 IIS6, Since yesterday, (12 Aug 2003) for some strange reason, (after installing WindowsServer2003-KB823980-x86-ENU.exe) I cannot pass the Request object to to VB COM DLL. I have...
2
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" />
8
by: Ricky K. Rasmussen | last post by:
Hello NG, I'm having some encoding trouble using my own RequestHandler: Since the RequestHandler must be able to serve content with diffrent encoding, I set the Response.Charset and...
5
by: Filip | last post by:
Hello, (ASP.NET c#) I want to put some common functions into one class and within this class I need to have access to the Session, Request and Response. This class is not page behind file! I...
3
by: Axel Dahmen | last post by:
Hi, I've created an aspx page taking a query string argument as parameter. Although I've correctly escaped umlauts in the query string, they do not appear in the QueryString collection. If I...
5
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great...
2
by: jp2express | last post by:
Does Request.QueryString need to be carried out using ASP, or can JavaScript handle this? I know it is simple, but I've never done it and I don't know what to search for. Say I wanted my...
2
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...
2
by: Water Cooler v2 | last post by:
Normally, in ASP.NET applications, we read from a Request object and write to the Response buffer. However, I wish to read the request object, do some validations on it, and route the request to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.