J
Java script Dude
Hello,
When URI parameter to be posted to a servlet/jsp contains high
(128-255) ASCII characters such as european accent chars, they should
be escaped using encodeURIParameter in JavaScript prior to submitting
to server. These chars are then replaced by default with a %xx%xx...
escaped sequences representing utf-8 value.
When my servlet parses the parameter, it is not processing the %xx%xx
utf-8 char as a single char but is processing each %xx as an individual
char.
Eg.
URI parameter value = "_201_É_.test"
JS 1.5 method encodeURIParameter gives = "_201_%C3%89_.test"
HTTPRequest.getParameter gives = "_201_É_.test"
[question]
Assuming that the encodeURIParameter method is doing the correct job
encodeing, is there any way to tell servlet engine to interpret the URI
as a utf-8 encoded sequence? How can I decode this parameter properly.
Notes:
. Deprecated JS method escape() encodes in hex representation of
extended ASCII value which servlet engine properly parses but since
this method is deprecated I am trying to avoid using it. Since my
application is going global, I need to look beyond ASCII.
. I am trying to avoid using HTTP Post because of a bug in IE 5.5 sp1
which neglegent sys admins in my company are still deploying with
re-images :[
Thanks,
JsD
When URI parameter to be posted to a servlet/jsp contains high
(128-255) ASCII characters such as european accent chars, they should
be escaped using encodeURIParameter in JavaScript prior to submitting
to server. These chars are then replaced by default with a %xx%xx...
escaped sequences representing utf-8 value.
When my servlet parses the parameter, it is not processing the %xx%xx
utf-8 char as a single char but is processing each %xx as an individual
char.
Eg.
URI parameter value = "_201_É_.test"
JS 1.5 method encodeURIParameter gives = "_201_%C3%89_.test"
HTTPRequest.getParameter gives = "_201_É_.test"
[question]
Assuming that the encodeURIParameter method is doing the correct job
encodeing, is there any way to tell servlet engine to interpret the URI
as a utf-8 encoded sequence? How can I decode this parameter properly.
Notes:
. Deprecated JS method escape() encodes in hex representation of
extended ASCII value which servlet engine properly parses but since
this method is deprecated I am trying to avoid using it. Since my
application is going global, I need to look beyond ASCII.
. I am trying to avoid using HTTP Post because of a bug in IE 5.5 sp1
which neglegent sys admins in my company are still deploying with
re-images :[
Thanks,
JsD