Bug 54589 - View Results Tree have a lot of Garbage characters if html page uses double-byte charset
View Results Tree have a lot of Garbage characters if html page uses double-b...
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.9
All All
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2013-02-20 09:27 UTC by yangliu
Modified: 2013-02-26 16:34 UTC (History)
1 user (show)



Attachments
jmx log screenshot (68.62 KB, text/1)
2013-02-20 09:27 UTC, yangliu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description yangliu 2013-02-20 09:27:33 UTC
Created attachment 29971 [details]
jmx log screenshot

I find if webpage is not utf8,View Results Tree have a lot of Garbage characters Garbage characters(even I changed Content coding),why?

JMeter:v2.9
jmeter-plugins :v0.56
JRE:java 7 u13
OS:windows 7 x64


Debug Sampler:
JMeterVariables:
JMeterThread.last_sample_ok=true
JMeterThread.pack=org.apache.jmeter.threads.SamplePackage@15d30b6
START.HMS=172634
START.MS=1361352394201
START.YMD=20130220
TESTSTART.MS=1361352405017

JMeterProperties:
HTTPResponse.parsers=htmlParser wmlParser
START.HMS=172634
START.MS=1361352394201
START.YMD=20130220
TESTSTART.MS=1361352405017
beanshell.server.file=../extras/startup.bsh
classfinder.functions.contain=.functions.
classfinder.functions.notContain=.gui.
cookies=cookies
htmlParser.types=text/html application/xhtml+xml application/xml text/xml
jmeter.laf.mac=System
jmeter.version=2.9 r1437961
log_level.jmeter=INFO
log_level.jmeter.junit=DEBUG
log_level.jorphan=INFO
not_in_menu=HTML Parameter Mask,HTTP User Parameter Modifier
remote_hosts=127.0.0.1
sampleresult.timestamp.start=true
system.properties=system.properties
upgrade_properties=/bin/upgrade.properties
user.properties=user.properties
wmlParser.className=org.apache.jmeter.protocol.http.parser.RegexpHTMLParser
wmlParser.types=text/vnd.wap.wml 
xml.parser=org.apache.xerces.parsers.SAXParser

SystemProperties:
awt.toolkit=sun.awt.windows.WToolkit
file.encoding=GBK
file.encoding.pkg=sun.io
file.separator=\
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.class.path=S:\apache-jmeter-2.9\bin\ApacheJMeter.jar;S:\apache-jmeter-2.9\lib\activation-1.1.1.jar;S:\apache-jmeter-2.9\lib\avalon-framework-4.1.4.jar;S:\apache-jmeter-2.9\lib\bsf-2.4.0.jar;S:\apache-jmeter-2.9\lib\bsh-2.0b5.jar;S:\apache-jmeter-2.9\lib\bshclient.jar;S:\apache-jmeter-2.9\lib\commons-codec-1.6.jar;S:\apache-jmeter-2.9\lib\commons-collections-3.2.1.jar;S:\apache-jmeter-2.9\lib\commons-httpclient-3.1.jar;S:\apache-jmeter-2.9\lib\commons-io-2.2.jar;S:\apache-jmeter-2.9\lib\commons-jexl-1.1.jar;S:\apache-jmeter-2.9\lib\commons-jexl-2.1.1.jar;S:\apache-jmeter-2.9\lib\commons-lang-2.6.jar;S:\apache-jmeter-2.9\lib\commons-lang3-3.1.jar;S:\apache-jmeter-2.9\lib\commons-logging-1.1.1.jar;S:\apache-jmeter-2.9\lib\commons-net-3.1.jar;S:\apache-jmeter-2.9\lib\excalibur-datasource-1.1.1.jar;S:\apache-jmeter-2.9\lib\excalibur-instrument-1.0.jar;S:\apache-jmeter-2.9\lib\excalibur-logger-1.1.jar;S:\apache-jmeter-2.9\lib\excalibur-pool-1.2.jar;S:\apache-jmeter-2.9\lib\geronimo-jms_1.1_spec-1.1.1.jar;S:\apache-jmeter-2.9\lib\htmllexer-2.1.jar;S:\apache-jmeter-2.9\lib\htmlparser-2.1.jar;S:\apache-jmeter-2.9\lib\httpclient-4.2.3.jar;S:\apache-jmeter-2.9\lib\httpcore-4.2.3.jar;S:\apache-jmeter-2.9\lib\httpmime-4.2.3.jar;S:\apache-jmeter-2.9\lib\jcharts-0.7.5.jar;S:\apache-jmeter-2.9\lib\jdom-1.1.2.jar;S:\apache-jmeter-2.9\lib\jodd-core-3.4.1.jar;S:\apache-jmeter-2.9\lib\jodd-lagarto-3.4.1.jar;S:\apache-jmeter-2.9\lib\jorphan.jar;S:\apache-jmeter-2.9\lib\jsoup-1.7.1.jar;S:\apache-jmeter-2.9\lib\jtidy-r938.jar;S:\apache-jmeter-2.9\lib\junit-4.10.jar;S:\apache-jmeter-2.9\lib\logkit-2.0.jar;S:\apache-jmeter-2.9\lib\mail-1.4.4.jar;S:\apache-jmeter-2.9\lib\oro-2.0.8.jar;S:\apache-jmeter-2.9\lib\rhino-1.7R4.jar;S:\apache-jmeter-2.9\lib\serializer-2.7.1.jar;S:\apache-jmeter-2.9\lib\slf4j-api-1.7.2.jar;S:\apache-jmeter-2.9\lib\soap-2.3.1.jar;S:\apache-jmeter-2.9\lib\tika-core-1.3.jar;S:\apache-jmeter-2.9\lib\tika-parsers-1.3.jar;S:\apache-jmeter-2.9\lib\xalan-2.7.1.jar;S:\apache-jmeter-2.9\lib\xercesImpl-2.9.1.jar;S:\apache-jmeter-2.9\lib\xml-apis-1.3.04.jar;S:\apache-jmeter-2.9\lib\xmlgraphics-commons-1.3.1.jar;S:\apache-jmeter-2.9\lib\xmlpull-1.1.3.1.jar;S:\apache-jmeter-2.9\lib\xpp3_min-1.1.4c.jar;S:\apache-jmeter-2.9\lib\xstream-1.4.2.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_components.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_core.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_ftp.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_functions.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_http.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_java.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_jdbc.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_jms.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_junit.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_ldap.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_mail.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_monitors.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_native.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_report.jar;S:\apache-jmeter-2.9\lib\ext\ApacheJMeter_tcp.jar;S:\apache-jmeter-2.9\lib\junit\test.jar
java.class.version=51.0
java.endorsed.dirs=D:\Program Files\java\lib\endorsed
java.ext.dirs=D:\Program Files\java\lib\ext;C:\Windows\Sun\Java\lib\ext
java.home=D:\Program Files\java
java.io.tmpdir=C:\Users\admin\AppData\Local\Temp\
java.library.path=D:\Program Files\java\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Common Files\NetSarang;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;D:\Program Files\fast;d:\Program Files\Bitvise Tunnelier\;d:\.android\/tools;d:\Program Files\VDownloader;D:\PROGRA~1\CONDUS~1\DISKEE~1\;D:\Program Files\nodejs\;C:\Users\admin\AppData\Roaming\npm\;.
java.runtime.name=Java(TM) SE Runtime Environment
java.runtime.version=1.7.0_13-b20
java.specification.name=Java Platform API Specification
java.specification.vendor=Oracle Corporation
java.specification.version=1.7
java.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
java.vendor.url.bug=http://bugreport.sun.com/bugreport/
java.version=1.7.0_13
java.vm.info=mixed mode, sharing
java.vm.name=Java HotSpot(TM) Client VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Oracle Corporation
java.vm.specification.version=1.7
java.vm.vendor=Oracle Corporation
java.vm.version=23.7-b01
line.separator=

log4j.configuration=file:S:\apache-jmeter-2.9\bin\log4j.conf
org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger
os.arch=x86
os.name=Windows 7
os.version=6.1
path.separator=;
sun.arch.data.model=32
sun.awt.enableExtraMouseButtons=true
sun.boot.class.path=D:\Program Files\java\lib\resources.jar;D:\Program Files\java\lib\rt.jar;D:\Program Files\java\lib\sunrsasign.jar;D:\Program Files\java\lib\jsse.jar;D:\Program Files\java\lib\jce.jar;D:\Program Files\java\lib\charsets.jar;D:\Program Files\java\lib\jfr.jar;D:\Program Files\java\classes
sun.boot.library.path=D:\Program Files\java\bin
sun.cpu.endian=little
sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
sun.desktop=windows
sun.io.unicode.encoding=UnicodeLittle
sun.java.command=S:\apache-jmeter-2.9\bin\ApacheJMeter.jar
sun.java.launcher=SUN_STANDARD
sun.jnu.encoding=GBK
sun.management.compiler=HotSpot Client Compiler
sun.net.http.allowRestrictedHeaders=true
sun.os.patch.level=Service Pack 1
user.country=CN
user.dir=S:\apache-jmeter-2.9\bin
user.home=D:
user.language=zh
user.name=admin
user.script=
user.timezone=Asia/Shanghai
user.variant=
Comment 1 Philippe Mouawad 2013-02-24 22:06:49 UTC
Date: Sun Feb 24 21:46:53 2013
New Revision: 1449555

URL: http://svn.apache.org/r1449555
Log:
Bug 54589 - View Results Tree have a lot of Garbage characters Garbage characters
Bugzilla Id: 54589

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
    jmeter/trunk/xdocs/changes.xml
Comment 2 Philippe Mouawad 2013-02-24 22:08:22 UTC
Hello,
Thanks for report.

Issues comes from the fact that response does not contain charset indication.

So you need to add this (you must use nightly build that will be available in some time):
sampleresult.default.encoding=GBK
Comment 3 Sebb 2013-02-25 00:32:53 UTC
(In reply to comment #2)
> 
> Issues comes from the fact that response does not contain charset indication.

The HTTP response headers don't contain the info, but the HTML does.

However JMeter does not currently detect that; perhaps it should if there is no charset in the header.

> So you need to add this (you must use nightly build that will be available
> in some time):
> sampleresult.default.encoding=GBK

That assumes all the pages in the test have the same default.
Comment 4 Sebb 2013-02-26 16:03:08 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > 
> > Issues comes from the fact that response does not contain charset indication.
> 
> The HTTP response headers don't contain the info, but the HTML does.
> 
> However JMeter does not currently detect that; perhaps it should if there is
> no charset in the header.

Actually, the code does try to extract the <meta http-equiv="content-type" tag.
But it fails in this case because of a bug in handling double-byte encodings.

I'm working on fixing that.

> > So you need to add this (you must use nightly build that will be available
> > in some time):
> > sampleresult.default.encoding=GBK

This will be reverted, as it's not needed.
 
> That assumes all the pages in the test have the same default.
Comment 5 Sebb 2013-02-26 16:34:23 UTC
Fixed in SVN by correcting extraction of meta content-type:


URL: http://svn.apache.org/r1450262
Log:
View Results Tree have a lot of Garbage characters if html page uses double-byte charset
Bugzilla Id: 54589

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
    jmeter/trunk/xdocs/changes.xml


The fix will be in snapshot builds from r1450262.