Bug 37140 - [PATCH]ResponseAssertion and HttpSampler don't work for national charsets
[PATCH]ResponseAssertion and HttpSampler don't work for national charsets
Status: CLOSED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.0.3
Other other
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-10-18 11:41 UTC by Henryk Paluch
Modified: 2005-10-20 06:42 UTC (History)
0 users



Attachments
jmeter_i18n_assertion.patch (3.51 KB, patch)
2005-10-18 11:42 UTC, Henryk Paluch
Details | Diff
jmeter_i18n_rev2.patch (4.71 KB, patch)
2005-10-18 13:41 UTC, Henryk Paluch
Details | Diff
jmeter_i18n_rev3.patch - just fixed rogue "Only in..." diff messages (4.40 KB, patch)
2005-10-18 13:48 UTC, Henryk Paluch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Henryk Paluch 2005-10-18 11:41:16 UTC
Hi!
 When attempting to use ReponseAssertion to search for national characters (in
UTF-8) found two bugs that prevent it:
* HttpSampler forget to copy contentType and cataEncoding in case of following
redirects 
* ResponseAssertion converts byte[] to String using just default constructor
(thus converting characters using Java system default encoding) - wich is wrong.
Above patch fixes both issues.
Comment 1 Henryk Paluch 2005-10-18 11:42:15 UTC
Created attachment 16732 [details]
jmeter_i18n_assertion.patch

Patch to fix bugs mentioned in description.
Comment 2 Henryk Paluch 2005-10-18 12:12:04 UTC
Hi!
  Found more problematic objects (for example RegexFunction does use
String(byte[]) again). Working on better patch. I have an idea to add new method
SampleResult.getResponseDataAsString() that would be handy for proper charset
conversion (as does that patch for ResponseAssertion now).
Comment 3 Henryk Paluch 2005-10-18 13:41:52 UTC
Created attachment 16733 [details]
jmeter_i18n_rev2.patch

Hi!
  Here is more advanced patch - it fixes charset handling for both
ResponseAssertion and RegexFunction. There is new convenience method
SampleResult.responseDataAsString() that does the trick.
  Note: that patch works for me, but all daring testers are encouraged to try
this piece of code.
Comment 4 Henryk Paluch 2005-10-18 13:48:19 UTC
Created attachment 16734 [details]
jmeter_i18n_rev3.patch - just fixed rogue "Only in..." diff messages
Comment 5 peter lin 2005-10-18 15:21:31 UTC
thanks for the information. I'll try to get to it tonight if I have time.

peter lin
Comment 6 Sebb 2005-10-20 02:15:46 UTC
Thanks.

The Response Assertion problem was already fixed in bug 25052.

Other fixes applied (though I did not add the convenience function).
Comment 7 peter lin 2005-10-20 05:13:23 UTC
I've added your name to the contributer page, thanks again for submitting the patch.

http://wiki.apache.org/jakarta-jmeter/JMeterCommitters?action=show

peter lin
Comment 8 Henryk Paluch 2005-10-20 14:42:56 UTC
Hi!
 Tested rel-2-1 branch - it works well. Closing that bug.
Thank you!