G
Guest
Hi...
Just noticed something odd... In old ASP if you had query parameters that
were invalid for their encoding (broken utf-8, say), ASP would give you back
chars representing the 8-bit byte value of the broken encoding, so you still
got something for every input byte.
This appears to have changed radically in ASP.Net, going down to the base
System.Text.Encoding object. Now, it appears to simply vaporize bytes that
don't fit in the encoding. You don't even get a ? placeholder like you get
in so many other contexts in asp.
Could anyone explain why there was such a dramatic change in the handling
of error cases? Is there a way using the .net framework to know if you had
an encoding error?
An example of the input:
/test.aspx?query=%C7%D1%B1%DB%BA%A3%B3%CA%B9%E6
In the above, C7, A3, B3, and E6 don't make a valid utf-8 stream, but
looking for Request.QueryString ("query") gives me the decoded version, just
missing any representation of the offending characters, i.e. three characters
1137, 1786, and 697 (which don't render in IE either by the way).
Request.QueryString ("query") in ASP would yield a 10-character string, with
each of the original bytes converted to the raw 8-bit value.
Seems like a pretty big difference in handling things and I don't see a way
of getting any kind of indication (Exception or something) that there was a
conversion error.
Thanks
-mark
Just noticed something odd... In old ASP if you had query parameters that
were invalid for their encoding (broken utf-8, say), ASP would give you back
chars representing the 8-bit byte value of the broken encoding, so you still
got something for every input byte.
This appears to have changed radically in ASP.Net, going down to the base
System.Text.Encoding object. Now, it appears to simply vaporize bytes that
don't fit in the encoding. You don't even get a ? placeholder like you get
in so many other contexts in asp.
Could anyone explain why there was such a dramatic change in the handling
of error cases? Is there a way using the .net framework to know if you had
an encoding error?
An example of the input:
/test.aspx?query=%C7%D1%B1%DB%BA%A3%B3%CA%B9%E6
In the above, C7, A3, B3, and E6 don't make a valid utf-8 stream, but
looking for Request.QueryString ("query") gives me the decoded version, just
missing any representation of the offending characters, i.e. three characters
1137, 1786, and 697 (which don't render in IE either by the way).
Request.QueryString ("query") in ASP would yield a 10-character string, with
each of the original bytes converted to the raw 8-bit value.
Seems like a pretty big difference in handling things and I don't see a way
of getting any kind of indication (Exception or something) that there was a
conversion error.
Thanks
-mark