Bug 37140

Summary: [PATCH]ResponseAssertion and HttpSampler don't work for national charsets
Product: JMeter - Now in Github Reporter: Henryk Paluch <hpaluch>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: CLOSED FIXED    
Severity: normal    
Priority: P2    
Version: 2.0.3   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: jmeter_i18n_assertion.patch
jmeter_i18n_rev2.patch
jmeter_i18n_rev3.patch - just fixed rogue "Only in..." diff messages

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!
Comment 9 The ASF infrastructure team 2022-09-24 20:37:36 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1624