I think you stumbled upon https://bz.apache.org/bugzilla/show_bug.cgi?id=61669

I believe, the filename could be added in correct spelling in the parameter named filename* encoded something like utf8''classif_r%c3%a9r%c3%a9fence.csv as shown in https://www.ietf.org/rfc/rfc6266.txt (Chapter 5. Examples).

It would help, if you could take a look at some modern browsers and report back, if and how they encode the filenames.

Felix

Am 15.02.22 um 12:27 schrieb Vincent Daburon:
Hi,
I can't upload file with a file name contains special characters on
Windows 10 and keep the file name in the multi-part filename

I use the java client implementation or the HttpClient4.

For example :
File path and file name :
C:/data/multi_part_upload_files/classif_référence.csv

For the demonstration, i use the "HTTP Mirror Server"
It is a POST
Path : /upload
hostname : localhost
port : 8081
Content Encoding :  UTF-8

1 parameter :
Name : param1
Value : value1

File upload :
File Path : C:/data/multi_part_upload_files/classif_référence.csv
Parameter name : file_0
Mime type : tex/plain

Client implementation Java (but the same behaviour with httpClient4)

Post request:
=========================================
POST http://localhost:8081/upload

POST data:
-----------------------------7d159c1302d0y0
Content-Disposition: form-data; name="param1"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

value1
-----------------------------7d159c1302d0y0
Content-Disposition: form-data; name="file_0"; filename="classif_r?f?rence.csv"
Content-Type: tex/plain
Content-Transfer-Encoding: binary

<actual file content, not shown here>
-----------------------------7d159c1302d0y0--

=========================================
The name is now : filename="classif_r?f?rence.csv
and not : classif_référence.csv

In the java client implementation
In the PostWriter
  public static final String ENCODING = StandardCharsets.ISO_8859_1.name();

but i put some trace and i see that encoding will be cp1252 (windows)

So there is confusion between sampler encoding set to UTF-8 in the
sampler GUI, the default charset set to cp1252 for Windows for file
encoding and the initial ENCODING set to
StandardCharsets.ISO_8859_1.name() for the defaut http sampler
encoding.

For me in the Java client implementation the charset must be the UTF-8
set manually in sampler GUI or the sampleresult.default.encoding=UTF-8
properties.

Some think like in the PostWriter  :
public static final String DEFAULT_HTTP_ENCODING =
StandardCharsets.ISO_8859_1.name();

     protected static final String DEFAULT_ENCODING =
JMeterUtils.getPropDefault("sampleresult.default.encoding",
DEFAULT_HTTP_ENCODING);
     private static final String ENCODING = DEFAULT_ENCODING;
     System.out.println("PostWriter ENCODING=" + ENCODING)

Regards.
Vincent DAB.

Attachment: OpenPGP_0xEA6C3728EA91C4AF.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to