2

I'm using Apache JMeter 2.8 to carry out some performance testing on one web-based information system.

There are several accented letters used in different requests - like 'ä', 'ö', 'ü' or 'õ'.

When it comes to running test scripts and executing requests, for example 'ä' value in some parameter turns into 'ä'. ('ä' - This is the way jmeter saves such character into a *.jmx file) Content encoding for these http requests is set to UTF-8. When i look at the contents of the project, all characters are displayed correcly. When i run test scripts wrong values are used.

Added later: I can successfully simulate GET requests with utf8 chars, but still accented characters in my POST requests look like 'ä'. What can be the reason, why jmeter's GET requests' data has proper utf8 encoding and POSTs Windows-1252/ISO-8859-1/cp1252/"ANSI" instead?

Any ideas why this happens? Thanks in advance!

3 Answers 3

6

The characters displayed don't only depend on the bytes of the input but what decoding the display is using to interpret them. For example, ä, when encoded as UTF-8, is the bytes 0xC3A4.

Now, what does 0xC3A4 look like when displayed? That depends what decoding is used. Here's some examples:

  • UTF-8: ä
  • Windows-1252/ISO-8859-1/cp1252/"ANSI": ä
  • UTF-16BE:
  • UTF-32:
  • Mac Os Roman: √§
  • Windows-1251: Г¤

And so on.

2
  • Vivid explanation.. Then what i can conclude in my case is that jmeter decodes this '0xC3A4' before putting it into request as Windows-1252/ISO-8859-1/cp1252/"ANSI" value and not UTF-8. Then probably i need to figure out if i can affect that sort of behaviour in some way..
    – Erik Kaju
    Jan 9, 2013 at 11:59
  • @ErikKaju well you can affect it unless the software is completely braindead. I just don't have any idea how exactly. I have no idea what JMeter even is. :)
    – Esailija
    Jan 9, 2013 at 15:10
5

JMeter saves character correctly in JMX, ensure that you opened them with the right encoding (UTF-8).

In JMeter there is this property:

  • sampleresult.default.encoding=ISO-8859-1

which you can change if this is not the default encoding. But I am not sure it's the issue you are facing.

Check the "Encode?"

Solution is:

  • set content encoding to UTF-8

  • Check Encode? in parameters table as your parameters are non ascii ones

if this does not work, it reveals an issue on tested application:

request.setCharacterEncoding("UTF-8") must be called before using parameters if it's a Java Application.

Same concepts exist for PHP and ASP.

7
  • I am using JMeter proxy and then afterwards where necessary change data fields into variables, add post processors and so on.. But regarding your answer, sampleresult.default.encoding was good tip. I changed that property and now all data in jmx is saved as UTF8. Now i can successfully simulate GET requests with utf8 chars, but still accented characters in my POST requests look like 'ä'. What can be the reason, why jmeter's GET requests' data has proper utf8 encoding and POSTs Windows-1252/ISO-8859-1/cp1252/"ANSI" instead?
    – Erik Kaju
    Jan 10, 2013 at 8:36
  • No, encode field made the thing even worse. But i already found the solution (pretty weird one). You can see it below. Big thanks for your answers and helpfulness!
    – Erik Kaju
    Jan 10, 2013 at 9:53
  • I also investigated that field. But encoding the parameter value means that the value sent to server will look completely different? Like %E4 instead of ä. I examined network traffic and requests of the system under test with FF Firebug and saw that these parameters have plain utf8 values. And based on this, i expect that request parameter values should not be encoded. What you think?
    – Erik Kaju
    Jan 10, 2013 at 10:13
  • Some additional info: The HttpClient3.1 thing works when Content encoding value is left empty. But this is OK for me as long as it works. Also encoding the value works well then :) If you happen to find out that this was JMeter's or HttpClient's bug, then report it somewhere. You seem to be the right person to do this, because as i see from your stackoverflow response history - JMeter seems to be your really strong side :) Good luck!
    – Erik Kaju
    Jan 10, 2013 at 10:29
  • Any news on that with my modified answer ? Jan 14, 2013 at 14:33
1

The thing got fixed by switching HTTP request implementation field from HttpClient4 to HttpClient3.1 + leaving HTTP Request Content encoding value empty :)

There might be some JMeter bug regarding using HttpClient4.

1
  • I investigated your Test Plan, and in fact it reveals an issue on your server application. Probably they are not calling request.setCharacterEncoding("UTF-8") if it's a Java Application, same concepts for PHP and ASP. When this is done Jan 10, 2013 at 11:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.