1

I am working on customization of some system. I cannot change server-side code. Server is waiting for file with filename. Our customers usually use cyrillic, non-ASCII characters within filename. My form is used for nonHTML5 browsers and it looks like

<form  action='http://someurl.ru' method='post' enctype="multipart/form-data">
<input id='fid' name="file" multiple="false" type="file" />
<input id='sub' type='submit'>
</form>

so, when this form is submitted i get something like

------WebKitFormBoundaryJgbfSe4B9AXNn2jO
Content-Disposition: form-data; name="file"; filename="крейзиНеАскиЧэрактэры.txt"
Content-Type: text/plain

My question is simple. How can i obligate browser to send filename urlencoded or file parameter with filename*=utf-8... header? It seems very simple, but i have spend hours already.

I have found similar question here UTF-8 text is garbled when form is posted as multipart/form-data but solution involves server changes, which i cannot do.

Any suggestions?

Community
  • 1
  • 1
  • You cannot force an HTML4 browser to encode filenames in a submitted `
    ` any particular way. If you cannot change the server code, you are SOL. The server should set an `accept-charset=utf-8` attribute on the `
    ` element, or send the HTML itself in UTF-8 with a suitable `Content-Type` header or `` element indicating UTF-8. Without `accept-charset`, browsers will usually encode a `
    ` in the same charset as the HTML (but the user can override that charset when viewing the HTML). HTML4 does not guarantee how browsers encode filenames in submitted forms, but HTML5 does.
    – Remy Lebeau Oct 06 '15 at 18:19
  • Tnx a lot for explanation. – user2834447 Oct 13 '15 at 09:12

0 Answers0