[Webtest] Request/response encoding problem
Tue, 17 Aug 2004 07:41:40 +1000
Marek Mosiewicz wrote:
> Hello, I repost a message which passed by uncommented, it was sent
> some time ago by my colleague:
> Is there any way to change response encoding. I sent back to the
> server hidden fields in a form on my page. The whole site is in
> ISO-8859-2 encoding. The server will acccept only ISO-8859-2 URL
> encoded parameters, I can't find way to force canoo to chage encoding.
> Please help .
You can change the character set used for encoding as follows:
<option name="DefaultCharacterSet" value="ISO-8859-2"/>
The default is "iso-8859-1"; the above would change it to "ISO-8859-2".
I am not exactly sure whether this is what you need - I never have fully
worked out when you need to change character set and when you need to
change encoding; the default for encoding is "UTF-8".
If this doesn't work, you will probably have to patch the encode()
method in the WebRequest.URLEncodedString class of HttpUnit. It has
special code for dealing with alternate character sets, but you could
change it to handle different encoding types using the overloaded
URLEncoder.encode() method which takes the encoding type as the second
Also, my experience with setting some options for the config is that
they sometimes don't work for the first testSpec inside a target, so you
might want to put a dummy testSpec (with the option as above) ahead of
your current testSpec steps (to which you would also add the above option).