Bug 64624

Summary: Russian language encode in field Type of error in Dashboard report
Product: JMeter Reporter: nonealexq <nonealexq>
Component: MainAssignee: JMeter issues mailing list <issues>
Severity: normal CC: 404051211, 805340489, p.mouawad
Priority: P2 Keywords: FixedInTrunk, PatchAvailable
Version: 5.2.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: png of dashboard
csv report
Encode JSON special chars, only

Description nonealexq 2020-07-24 16:33:53 UTC
Created attachment 37371 [details]
png of dashboard

I have a problem with encoding when generating a dashboard report.
In .csv file the label field is displayed correctly in Russian language, but in Type of error field the text is displayed incorrectly ('\u041A \u0441\u043E\u0436\...').
In the search for the truth, I replaced sampleresult.default.encoding = UTF-8 in jmeter.propertis, I also added this encoding for all my requests.
Found such a bug https://bz.apache.org/bugzilla/show_bug.cgi?id=59889 and it went into the release, checked that this patch is in my version ..

I generate the report like this:
eval $ jmeter -g $ loadReports /report1.csv -o $ loadReports /report

or so, if it is launched through teamcity:
jmeter -n -t $ {JMETER_PATH} / test-plan / $ {FILE_NAME} .jmx -Jlayer = $ {LAYER} -Jusers = $ {USERS_NUMBER} -l /result/result_$ {FILE_NAME }.jtl -j / result /jmeter_$ {FILE_NAME }.log -e -o / result / report _ $ {FILE_NAME} /
Please tell me how i can fix it
Comment 1 nonealexq 2020-07-24 16:35:03 UTC
Created attachment 37372 [details]
csv report
Comment 2 nonealexq 2020-07-24 16:39:22 UTC
Sorry, I have a mistake in the sentence.
In the csv file, the encoding and words are correct, but after generating the report, this field Type of error is generated incorrectly**
Comment 3 Philippe Mouawad 2020-07-26 13:02:45 UTC
The issue is due to this:


Escaping is needed to avoid reserved characters breaking the Javascript code.
But the method transforms russian chars into their unicode representation leading to what you see.
Comment 4 nonealexq 2020-07-26 15:01:14 UTC
Thanks for the answer, I assumed that the matter is somewhere in the root of the Java script. Tell me how I can fix this, as I see, this code snippet is already in visitValueResult, but in version 5.3 I also have broken encoding
Comment 5 Philippe Mouawad 2020-07-26 15:37:16 UTC
For now all I can propose to you is build your own version of JMeter with the call to escape commented.
Keep the replace.

Comment 6 nonealexq 2020-07-26 15:59:49 UTC
Thank you, in the near future I will add a java script file here that can help other guys who have encountered the same problem
Comment 7 nonealexq 2020-07-27 00:54:08 UTC
In fact, the problem was in the generation and you can fix it - replace \\ with \. Hastily drew a solution in the form of a bash script:


_dashPath=$(find -name "dashboard.js")
_template='\\\\'; _raplace='\\'

_arrFiles=$(echo $_dashPath | tr " " "\n")

for x in $_arrFiles
    echo "\"$x\""
    sed -i -e "s%$_template%$_raplace%g" $x
Comment 8 Felix Schumacher 2020-08-21 10:07:53 UTC
*** Bug 64682 has been marked as a duplicate of this bug. ***
Comment 9 Felix Schumacher 2020-08-21 10:54:53 UTC
Created attachment 37400 [details]
Encode JSON special chars, only

The attached patch seems to work with the given Russian sample CSV file.
Comment 10 yicaifeitian 2020-08-24 01:52:51 UTC
Thank very much, this bug is disapper 3.X . 
long long ago, i think whether my config wrong, and then i try envthing i can(but not commit this bug)

@nonealexq, Thank very much! I got the answer.
Comment 11 Philippe Mouawad 2020-08-29 09:03:44 UTC
Hello Felix,
This looks good to me. 
Thanks for fix

Comment 12 Felix Schumacher 2020-08-30 08:03:51 UTC
Committed to trunk. Could you test the next nightly and report back, whether it fixed your problems?

commit 21128b56ac4fa1f4d9a260b1f0e4ec3cfa7f033b
AuthorDate: Fri Aug 21 12:53:01 2020 +0200

    Use less aggressive escaping for JSON Strings in reports error messages
    Bug 64624
 .../org/apache/jmeter/report/dashboard/JsonizerVisitor.java   |  5 +++--
 .../apache/jmeter/report/processor/ErrorsSummaryConsumer.java | 11 +++++++++--
 xdocs/changes.xml                                             |  1 +
 3 files changed, 13 insertions(+), 4 deletions(-)
Comment 13 Felix Schumacher 2020-08-30 08:47:08 UTC
commit 9a900cb55604c45f7a85dbcd78ba210a17dd9f72
AuthorDate: Sun Aug 30 10:44:47 2020 +0200

    Correct test cases for new behaviour of report generation
    Use less aggressive escaping for JSON Strings in reports error messages
    Relates to 21128b56ac4fa1f4d9a260b1f0e4ec3cfa7f033b
    Bugzilla Id: 64624
 .../org/apache/jmeter/report/processor/ErrorsSummaryConsumerTest.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 14 Felix Schumacher 2020-09-06 09:02:37 UTC
*** Bug 63997 has been marked as a duplicate of this bug. ***
Comment 15 Felix Schumacher 2020-09-06 09:07:35 UTC
To any of the original reporters. Could you test the current nightlies and report back, if your problems are fixed?
Comment 16 nonealexq 2020-09-06 09:40:00 UTC
Hi, I'd love to check it out, but can't find the build, tell me where can I download the nightly build with this fix?
Comment 17 Felix Schumacher 2020-09-06 09:45:05 UTC
Thanks, have a look at https://jmeter.apache.org/nightly.html. Both nightlies and current builds from trunk should work.
Comment 18 Felix Schumacher 2020-09-06 09:48:00 UTC
Note, that due to current changes of the build infrastructure, the current trunk builds might have been moved to https://ci-builds.apache.org/job/JMeter/job/JMeter-trunk/
Comment 19 nonealexq 2020-09-06 14:30:08 UTC
Created attachment 37425 [details]

All OK! Thank you very much for the work done. I attach two files before and after the fix
Comment 20 nonealexq 2020-09-06 14:30:25 UTC
Created attachment 37426 [details]