Bug 64624 - Russian language encode in field Type of error in Dashboard report
Summary: Russian language encode in field Type of error in Dashboard report
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.2.1
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk, PatchAvailable
: 63997 64682 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-07-24 16:33 UTC by nonealexq
Modified: 2020-09-07 07:35 UTC (History)
3 users (show)



Attachments
png of dashboard (88.81 KB, image/png)
2020-07-24 16:33 UTC, nonealexq
Details
csv report (792 bytes, text/csv)
2020-07-24 16:35 UTC, nonealexq
Details
Encode JSON special chars, only (3.95 KB, patch)
2020-08-21 10:54 UTC, Felix Schumacher
Details | Diff
beforeFix (275.94 KB, image/png)
2020-09-06 14:30 UTC, nonealexq
Details
afterFix (211.93 KB, image/png)
2020-09-06 14:30 UTC, nonealexq
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nonealexq 2020-07-24 16:33:53 UTC
Created attachment 37371 [details]
png of dashboard

Hello!
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:

https://github.com/apache/jmeter/blob/master/src/core/src/main/java/org/apache/jmeter/report/dashboard/JsonizerVisitor.java#L99

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
Hello,
For now all I can propose to you is build your own version of JMeter with the call to escape commented.
Keep the replace.

Regards
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:

#!/bin/sh

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

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

for x in $_arrFiles
do
    echo "\"$x\""
    sed -i -e "s%$_template%$_raplace%g" $x
done
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

Regards
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]
beforeFix

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]
afterFix