34

I can't seem to find any character encoding options in SoapUI preferences.

I want to mock xml response in iso-8859-1 encoding.

Rao
  • 20,781
  • 11
  • 57
  • 77
user310291
  • 36,946
  • 82
  • 271
  • 487
  • Very good question: in particular, because Soapui tries to send JSON in something else but UTF-8 on my system, although anything else but UTF-8 is invalid for JSON. – ceving Jul 25 '22 at 13:58

4 Answers4

64

To set up an encoding for request/response you have to mark it in Navigator. Then in the view under the navigator go to "Request/Response properties" choose encoding and set i.e. to UTF-8 or iso-8859-1. enter image description here

TouDick
  • 1,262
  • 12
  • 18
10

You may choose either of the following approach.

Changing the defualt encoding

  1. Go to SOAPUI_HOME/bin.
  2. Open soapui.bat/.sh, depending on your platform.
  3. You should be able find JAVA_OPTS, then you can add there below line in a new line set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding="iso-8859-1" on windows
    export JAVA_OPTS=$JAVA_OPTS -Dfile.encoding="iso-8859-1" on unix
  4. Save the file, start SoapUI.

It should take default encoding as iso-8859-1.

Alternatively, message specific:

Otherwise, you may use message specific character encoding using http headersfor that specific one in the following way:

Set a new header for request / response.
Header Key/name:Content-Type
Header Value :text/xml; charset=iso-8859-1

Rao
  • 20,781
  • 11
  • 57
  • 77
  • 3
    For those trying this out and it doesn't work, SmartBear changed things around a bit. The file that needs to be edited is `SoapUI-5.#.#.vmoptions` (replacing # with your Version). Add the line `-Dfile.encoding=UTF8` (Note without "") **before** the line `-splash:SoapUI-Spashscreen.png`. Do that and it will work as described in this answer. – Bernd Linde Oct 16 '19 at 14:25
7

I know this is an old question but the accepted answer doesn't work for me, I'm in Windows10, in my case I update the SoapUI-5.6.0\bin\SoapUI-5.6.0.vmoptions file, add a new JVM arguments:

-Dfile.encoding=UTF-8

Then restart the SOAP-UI, the response can return the correct content(e.g. with some special characters like ®)

Dharman
  • 30,962
  • 25
  • 85
  • 135
Terrence Wei
  • 195
  • 1
  • 7
1

if you have windows
1- Open NotePad++ as a admin
Go to path C:\Program Files (x86)\SmartBear\SoapUI-5.3.0\bin open soapui.bat and search for

set JAVA_OPTS=%JAVA_OPTS% -Djava.library.path="%SOAPUI_HOME%\"
set JAVA_OPTS=%JAVA_OPTS% -Dwsi.dir="%SOAPUI_HOME%..\wsi-test-tools"
*****set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding="iso-8859-1"*****

Add the last line above set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding="iso-8859-1" by taking the ***** out.

Save and restart SOAPUI

Cœur
  • 37,241
  • 25
  • 195
  • 267
Boris_Ndong
  • 247
  • 2
  • 4