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 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
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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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;
|
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,...
|
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...
|
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...
|
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"...
| |
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...
|
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...
|
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...
|
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,...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
|
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...
| |