Katalon POSt Request with multipart/form-data and formdata fields conrtains utf-8 text not submittd the text in the same format

I would show you an evidence. Please find the attached zip, which contains a small Katalon Studio project. I made it using KS v8.1.0, but is version-independent. You can open it with any KS version.

web-service-tests.zip (111.8 KB)

Steps to reproduce

  1. open the web-service-tests project with KS
  2. find a TestObject in “Object Repository” > “POST multipart form-data”
  3. The TestObject defines a WebService Request. In “HTTP Header” tab, it has a header “Content-Type: multipart/form-data”
  4. In “HTTP Body” tab, it includes 3 part:
  • “data-in-us-ascii”, TEXT, “text/plain”, “hello,world”
  • “data-in-german”, TEXT, “text/plain;charset=utf-8”, “Grüß Gott!”
  • “data-in-japanese”, TEXT, “text/plain;charset=utf-8”, “こんにちは”
  1. Katalon Studio GUI did not allow me to type “text/plain;charset=utf-8” here. So I closed KS, open an editor, select a file <projectDir>/Object Repository/POST multipart/form-data.rs which is an XML file. I editted 2 lines:
    &quot;contentType&quot;: &quot;text/plain&quot; =>
    &quot;contentType&quot;: &quot;text/plain; charset=utf-8&quot;
  2. I reopened the project in KS, I checked the Test Object and found it has text/plain; charset=utf-8
  3. In the command line, cd to the project directory, run a command:
$ cd web-service-tests
$ groovy server.groovy

here I assume you have the Groovy interpreter is installed and runnable in the commandline.
8. server.groovy is a simple HTTP server, it listens to the URL http://localhost:80/. This server is open-sourced at GitHub - opengl-8080/groovy-http-server: Simple HTTP Server by Groovy. developed by opengl-8080. I amended the original slightly.
9. The server can print the HTTP Header and HTTP Body of the request it received.
10. The server decodes the bytes in the HTTP Request into UNICODE string assuming that the HTTP Body is encoded in UTF-8.
11. Now you want to go back the Katalon project. Run the Test Object by clicking run_katalon_test button on the Test Object definition pane.
12. In the console, the server prints the HTTP Body as follows:

$ groovy server.groovy

port=80
base-dir=/Users/kazuakiurayama/katalon-workspace/web-service-tests/.

method = GET
uri = /
body = --sWdL5Jwq5EuDfY-bB3E9w4upALqVJrm
Content-Disposition: form-data; name="data-in-german"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Gr?? Gott!
--sWdL5Jwq5EuDfY-bB3E9w4upALqVJrm
Content-Disposition: form-data; name="data-in-japanese"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

?????
--sWdL5Jwq5EuDfY-bB3E9w4upALqVJrm
Content-Disposition: form-data; name="data-in-us-ascii"
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

hello, world
--sWdL5Jwq5EuDfY-bB3E9w4upALqVJrm--

Please note, non US-ASCII characters are garbled; Grüß Gott! is printed as Gr?? Gott!. This proves that the HTTP Request sent from Katalon Studio to the server is NOT encoded in utf-8; most probably is encoded in ISO-8859-1 = US-ASCII.

I would conclude, Katalon Studio can not send a Web service Request of multipart/form-data in utf-8, therefore it can not support international languages (German, Japanese, etc) which require utf-8.

I read the source codes of Katalon Studio v8.0.5, e.g, com.kms.katalon.core.webservice.common.BasicRequestor#send() and other classes. I found it is NOT implemented to encode multipart sections in utf-8 even if these have a Content-Type text/play; charset=utf-8.

1 Like