Search code examples
utf-8character-encodingjmeterjsr223

JMeter - JSR223 Sampler missing character encoding


When I use JSR223 Sampler and print non English characters as อักษรไทย

I can't be seen in output, converted to ????????

I see that the encoding isn't set to UTF-8 in Sampler Result

SampleResult fields:
ContentType: 
DataEncoding: windows-1255

Can I set JSR223 Sampler output encoding to UTF-8?


Solution

  • Most likely it's the problem of the destination you're printing this stuff to, if you use log shorthand which prints an arbitrary line to jmeter.log file you should normally see non-English characters

    If you're writing non-ANSI text into a custom file to be on the safe side you could explicitly define encoding like:

    new File("foo.txt").newOutputStream().withWriter("UTF-8") { writer ->
        writer.write('อักษรไทย')
    }
    

    Demo:

    enter image description here