473,503 Members | 5,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Character lost in POST submit

Hello,

I am experiencing a weird behaviour on my ASP.NET project. The project
consists from client-side, which can be whatever environment - web page, EXE
application, etc. The client sends HTTP POST request to the server with
data, and the server has ASP.NET application that handles the request and
gives answer.

I have biled all the fat code down to a very simple test case, which
consists from three files - HTML page, which does runtime HTTP POST request
(available in IExplorer from JS5, and all versions of Mozilla), and calls
two supposed-to-be-identical scripts, one done in classic ASP, another in
ASP.NET. The latter seems to lose all the characters 0xE4 in the incoming
POST data.

Please see the demo code here: http://www.s3.lv/demo/msnews.lostcharacter ,
you can also download the source code there.

I am now considering to do some mumbo-jumbo to handle the "%e4" characters
in some other way, what is hassle af course, because it involves both client
and server side code adjustments. It would be nice to understand, why this
is happening.

Regards,

Pavils
Nov 19 '05 #1
6 2495
Pavils Jurjans wrote:
Hello,

I am experiencing a weird behaviour on my ASP.NET project. The
project consists from client-side, which can be whatever environment
- web page, EXE application, etc. The client sends HTTP POST request
to the server with data, and the server has ASP.NET application that
handles the request and gives answer.

I have biled all the fat code down to a very simple test case, which
consists from three files - HTML page, which does runtime HTTP POST
request (available in IExplorer from JS5, and all versions of
Mozilla), and calls two supposed-to-be-identical scripts, one done in
classic ASP, another in ASP.NET. The latter seems to lose all the
characters 0xE4 in the incoming POST data.
First of all, what is 0xE4 supposed to be? A Unicode code point? A
character from an 8 bit character encoding?
Please see the demo code here:
http://www.s3.lv/demo/msnews.lostcharacter , you can also download
the source code there.

I am now considering to do some mumbo-jumbo to handle the "%e4"
characters in some other way, what is hassle af course, because it
involves both client and server side code adjustments. It would be
nice to understand, why this is happening.


Your test code claims to post UTF-8, but 0xE4 is not a valid byte
sequence in UTF-8. Thus, the ASP.NET UTF-8 decoder stops after "a=X". I
guess the reason why it works in ASP is that the ASP runtime ignores
the charset attribute and uses some default character encoding like
ISO-8859-1 or Windows-1252 for which 0xE4 is a valid character.

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

"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:xn****************@msnews.microsoft.com...
First of all, what is 0xE4 supposed to be? A Unicode code point? A
character from an 8 bit character encoding?
It's a character code for an Estonian character.
Your test code claims to post UTF-8, but 0xE4 is not a valid byte
sequence in UTF-8. Thus, the ASP.NET UTF-8 decoder stops after "a=X". I
guess the reason why it works in ASP is that the ASP runtime ignores
the charset attribute and uses some default character encoding like
ISO-8859-1 or Windows-1252 for which 0xE4 is a valid character.


This really shouldn't matter, because the sequence is URL-encoded anyway.

Pavils
Nov 19 '05 #3
Pavils Jurjans wrote:
Hi Joerg,

"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:xn****************@msnews.microsoft.com...
First of all, what is 0xE4 supposed to be? A Unicode code point? A
character from an 8 bit character encoding?


It's a character code for an Estonian character.


In what encoding? In Unicode, this character is "ä".
Your test code claims to post UTF-8, but 0xE4 is not a valid byte
sequence in UTF-8. Thus, the ASP.NET UTF-8 decoder stops after
"a=X". I guess the reason why it works in ASP is that the ASP
runtime ignores the charset attribute and uses some default
character encoding like ISO-8859-1 or Windows-1252 for which 0xE4
is a valid character.


This really shouldn't matter, because the sequence is URL-encoded
anyway.


It does matter. URL encoding is a means to transport special characters
(or rather their code points) in URLs using safe character sequences.
Sender and receiver need to agree on how to map those sequences to the
real characters. There's no implict or default character encoding when
using URL encoding.

If "ä" is the character you want to use, try %C3%A4 instead -- that's
the proper way to URL encode it based on UTF-8.

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

I once experienced problems with my website losing my £ pound sign on
postback.
"Pavils Jurjans" <pa****@mailbox.riga.lv> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,

I am experiencing a weird behaviour on my ASP.NET project. The project
consists from client-side, which can be whatever environment - web page,
EXE application, etc. The client sends HTTP POST request to the server
with data, and the server has ASP.NET application that handles the request
and gives answer.

I have biled all the fat code down to a very simple test case, which
consists from three files - HTML page, which does runtime HTTP POST
request (available in IExplorer from JS5, and all versions of Mozilla),
and calls two supposed-to-be-identical scripts, one done in classic ASP,
another in ASP.NET. The latter seems to lose all the characters 0xE4 in
the incoming POST data.

Please see the demo code here: http://www.s3.lv/demo/msnews.lostcharacter
, you can also download the source code there.

I am now considering to do some mumbo-jumbo to handle the "%e4" characters
in some other way, what is hassle af course, because it involves both
client and server side code adjustments. It would be nice to understand,
why this is happening.

Regards,

Pavils

Nov 19 '05 #5
Hi

I once experienced a similar problem with a page losing my £ pound sign on
postback.

Not sure if it is the same thing or not, but here is what the problem
was....
http://www.howtodothings.com/ViewArt...b520eeb0c77a42
--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/
Nov 19 '05 #6
Hi Joerg,
It does matter. URL encoding is a means to transport special characters
(or rather their code points) in URLs using safe character sequences.
Sender and receiver need to agree on how to map those sequences to the
real characters. There's no implict or default character encoding when
using URL encoding.


It nice to see a person here who knows the talk about encodings and their
application in transfers, its a true rarity.

I was somewhat blinded by assumption, that the only thing the server does is
decodes URL-encoded content, and creates string from the aquired charcodes
right away. Of course, there comes the character conversion in the middle! I
checked a code that I wrote for classic ASP two years ago, that was doing
just that - since the classic ASP did not intercept any character encoding
information for the incoming POST data (nor the browser is obliged to send a
hint), I made a code that reads the Request.BinaryRead(), splits the
received content by "=" and "&" characters, URL-decodes every key-value
pair, and finally applies the character encoding provided in the function
parameter, to get the correct unicode string.

I decided to solve my %e4 problem by committing to the server a direct code
point information:

var dataBody = "a=%u00e4";

This works on both classic ASP and ASP.NET, and I need not to bother about
the applied character encodings.

Thanks for opening my eyes,

Pavils
Nov 19 '05 #7

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

Similar topics

2
3478
by: Bartosz Wegrzyn | last post by:
Hi, I have simple web with authentication. My main page looks like this: <?php include ("nav.htm"); include ("auth.php"); $menu = $_GET;
8
5079
by: dmcconkey | last post by:
Hi folks, I have a client with four websites. Each site has a contact form that is identical. They all have "required" fields validated through a JavaScript onSubmit() function. Upon validation,...
0
1397
by: SteveS | last post by:
Hello, this problem is driving me nuts! I am using the Content Ratings (RSACi) for my website. The settings strictly "G" rated - No violence, sex, nudity or offensive language. I have a user...
2
450
by: CCP | last post by:
I've got a simple HTML page containing a form and a few hidden variables. This form post into a .Net application (that lives in a seperate directory). The first thing I do in my codebehind is...
8
2042
by: bdobby | last post by:
Hi. I am relatively new to js, but I did think I was starting to get the hang of it. Then this happened... I have a form with an onsubmit event handler: <form id="uploadForm" method="post"...
12
2621
by: amer.terzic | last post by:
Here's what my code is supposed to do (it seems to work fine) Take a char* array and remove a first character from it....as simple as that. The mentioned char* array is a 'global' var shared...
3
2054
by: Vic Spainhower | last post by:
Hello, I have an HTML table that is being constructed from a MySQL table and displays a form that includes a check box on 1 of the fields on the form for each record. I have included in this PHP...
0
1420
vikas251074
by: vikas251074 | last post by:
I am using Oracle 9i and ASP I have empno, empname, designation, category, dob. Category have two option 'S' or 'O' When I enter empno, empname, designation, category and dob and when I...
0
7188
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
7063
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...
0
7258
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,...
1
6970
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...
0
7441
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
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
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 ...
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.