The HTML tag: <META http-equiv="Content-Type" content="text/html; charset=utf-8"> is treated by browsers the same as the Content-Type header. At present (JMeter 2.3) JMeter does not extract this information, it only uses headers. If no charset is present, then the platform default encoding (overridable by defining sampleresult.default.encoding) is applied when converting the response to a string. This means that the conversion of the responseData to a string may not produce the correct result - for example in the Tree View Listener, and presumably in Post-Processors. JMeter could extract the content-type from the data. It probably needs to check that the data is intended to be used as HTML first - i.e. the existing Content-Type should specify text/html.
Fixed in SVN r587702
On further reflection, perhaps this could be improved: rather than only processing the meta content-type if the header content-type did not include a charset/dataEncoding, maybe the meta tag should always be processed, and used to update the sampler fields? The original headers would still be available from getResponseHeaders.
the fix in HTTPSampleResult does not work : in the method getDataEncodingWithDefault the test : getDataEncodingNoDefault() == null is always false because of the setDataEncoding(DEFAULT_HTTP_ENCODING); in the constructor please note that there is no workaround to this bug because DEFAULT_HTTP_ENCODING can not be overriden with sampleresult.default.encoding
line 42 in HTTPSampleResult : setDataEncoding(DEFAULT_HTTP_ENCODING); // default if encoding not provided be the page should probably be removed
Created attachment 24291 [details] Path that removes encoding setting in constructor Hello, Attached is a patch that applies Benoit Proposition. If encoding is set through header, encoding declared in meta will not be taken into account. Otherwise it will. Philippe http://www.ubik-ingenierie.com
Thanks for the patch. Applied with further fix so ensure correct default was used. URL: http://svn.apache.org/viewvc?rev=929364&view=rev Log: Bug 43678 - Handle META tag http-equiv charset? Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java jakarta/jmeter/trunk/xdocs/changes.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2038