SOAP-UI Mock: Response in different character sets on different systems - WHY?
I have the odd case that a mock service that I defined works as intended on one system but not on another (both are Windows 10 workstations/laptops running the same version, configured with the same system language and character set and running the same Java version (AdoptOpenJDK v8.x)). On one system the payload is returned in the character set intended (UTF-16LE), on another the response is in a different character set (ISO-8891-5). Any explanation for that?
Background:
I need to create a REST-service mock that returns its response in an unusual character set: UTF-16LE.
For that I created a text-file (the name of the file is passed via a custom property) with the bitwise exact content of the intended response (i.e. saved in UTF-16LE) and I defined a scripted mock-response that reads the content of that file and returns it like so:
def path = context.expand('${#MockService#responseFileName}').trim()
log.info("reading data from '${path}'")
def file = new File(path)
if (file.exists() && file.isFile()) {
byte[] fileBytes = file.bytes
int length = fileBytes.length
log.info("read ${length} bytes of data: '${fileBytes}'")
String str = new String(fileBytes, java.nio.charset.StandardCharsets.UTF_16LE)
mockResponse.responseContent = str
} else {
throw new Exception("file '${path}' not found!")
}
The "Content | Media type:" defined in the response form is "text/csv; charset=UTF-16LE".
If I run that mock on my own laptop then the response I get from this service is EXACTLY as contained in the original file (i.e. in characters set of the response is signaled in the response header (as received by the browser and checked using FF's Web Developer tools) as "UTF-16LE" - as intended - and when saving the content to a file and comparing it to the original it is bitwise identical). This is as it should be!
But when the very same mock (i.e. same SOAP-UI project file and the very same input file (verified!)) runs on a colleague's laptop, then the character set signaled in the response header is "text/csv; charset=ISO-8859-1" (i.e. the header specified in the response form seems to be ignored)/overruled - why and by what?) and the content is indeed in ISO-8859-1 character set (aka. "ANSI"), i.e. different from my own laptop.
We are completely puzzled! Why does SOAP-UI behave so differently on two different systems? We faithfully checked all settings and preferences but we could not locate any differences. What can interfere here? What configuration controls this?