question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multipart form-data with cyrillics are replaced by '?'

See original GitHub issue

Here is my method for example:

    public void postSomething(){

        RestAssured.config = RestAssured.config()
                .encoderConfig(encoderConfig().defaultContentCharset("UTF-8"))
                .encoderConfig(encoderConfig().defaultCharsetForContentType("UTF-8", "multipart/form-data"))
                .multiPartConfig(multiPartConfig().defaultCharset("UTF-8"))
                .decoderConfig(decoderConfig().defaultContentCharset("UTF-8"))
                .decoderConfig(decoderConfig().defaultCharsetForContentType("UTF-8", "multipart/form-data"));

        String response = given().log().all()
                .multiPart(new MultiPartSpecBuilder(Charsets.UTF_8).build())
                .config(RestAssuredConfig.config().httpClient(HttpClientConfig.httpClientConfig()
                        .httpMultipartMode(HttpMultipartMode.BROWSER_COMPATIBLE)))
                .contentType("multipart/form-data; charset=UTF-8")
                .multiPart("cyrillic", "ЙЦУКЕН фывап")
                .when()
                .post("http://df4d777e.ngrok.io/123")
                .then().log().all()
                .assertThat().extract().response().body().asString();
    }

Console logs looks fine i guess изображение

but on server it looks like this изображение

Windows 10 Rest-assured 4.1.2

Is there anything i’m doing wrong?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
levevgvikcommented, Sep 17, 2021

Try this .multiPart(new MultiPartSpecBuilder(“ЙЦУКЕН фывап”).controlName(“cyrillic”).charset(StandardCharsets.UTF_8).build())

0reactions
sleepstreamcommented, Dec 24, 2021

Try this .multiPart(new MultiPartSpecBuilder(“ЙЦУКЕН фывап”).controlName(“cyrillic”).charset(StandardCharsets.UTF_8).build())

Thanks a lot!! It’s worked for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

RestEasy - upload file (multipart/form-data) with cyrillic name
I tried a couple of ways to change it: With new String(filename.getBytes("US-ASCII"), "UTF-8") - didn't work; ...
Read more >
Problems with the filename encoding when upload... - JBoss.org
Hello guys. I have this problem and I tried couple of things. Nothing has worked. Could you please follow this question:
Read more >
Multipart (Form Data) Format - MuleSoft Documentation
DataWeave supports Multipart subtypes, in particular form-data . These formats enable you to handle several different data parts in a single payload, ...
Read more >
Encoding problems when using multipart/form-data - Forums
When I remove the enctype="multipart/form-data" attribute needed for file uploads, ... I turned parseUtf8PostData on and the behaviour didn't change.
Read more >
Setting different content-type for form fields in multipart/form-data
Hello all, I am using the HTTP Request Wizard to upload a file along with Json to specify how the end-point will 'process'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found