JMeter sample response encoding

15,248

Solution 1

Right property to set / change in jmeter.properties is

 sampleresult.default.encoding=UTF-8

(if omitted default is ISO-8859-1)

Solution 2

Add a BSF post processing element to the sampler with the following script:

prev.setDataEncoding("UTF-8")

That's what worked for me.

Share:
15,248
ddario
Author by

ddario

Updated on June 15, 2022

Comments

  • ddario
    ddario almost 2 years

    I'm having problems with JMeter's handling of unicode characters. When a sample response contains such characters, they are returned corrupted. For example, I'm using the dummy sampler with this response data:

    Hauptschule Sankt Pýlten, Pottenbrunn
    

    And JMeter returns:

    Hauptschule Sankt P�lten, Pottenbrunn
    

    I've set these properties in saveservice.properties and jmeter.properties respectively:

    _file_encoding=UTF-8
    sampleresult.default.encoding=UTF-8
    

    but it makes no difference.

    Any ideas on how to fix this? Thanks

  • Boris
    Boris about 7 years
    Just as a note: The BSF post processing is deprecated for some time and will be removed in 3.3 AFAIK. But of course this also works fine with a JSR223 PostProcessor when selecting either one of the beanshell or javascript languages.
  • David Le Borgne
    David Le Borgne over 2 years
    Successfully used this syntax in a JSR223 PostProcessor using JMeter 5.4.1