Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad filename when having non ASCII characters #1401

Open
2 tasks done
jackdeguest opened this issue May 16, 2022 · 4 comments · May be fixed by #1531
Open
2 tasks done

Bad filename when having non ASCII characters #1401

jackdeguest opened this issue May 16, 2022 · 4 comments · May be fixed by #1531
Labels
bug Something isn't working new Needs triage. Comments are welcome!

Comments

@jackdeguest
Copy link

Checklist

  • I've searched for similar issues.
  • I'm using the latest version of HTTPie.

Minimal reproduction code and steps

  1. save a dummy image as 天狗.png
  2. issue a multipart/form-data, such as: https --offline --multipart https://example.org name='John Doe' file_field@/home/john/天狗.png > /tmp/httpie_result.txt

Current result

The Content-Disposition header generated will be something like: Content-Disposition: form-data; name="file_field"; filename="天狗.png"

Expected result

The Content-Disposition header should conform to rfc2231. So this should rather be: Content-Disposition: form-data; name="file_field"; filename*=UTF-8''%E5%A4%A9%E7%8B%97.png

You can generate the proper encoded filename in accordance with rfc2231 using the perl command line perl -MEncode -MURI::Escape::XS -lE 'say URI::Escape::XS::uri_escape( Encode::decode_utf8("天狗.png") )'


Debug output

Please re-run the command with --debug, then copy the entire command & output and paste both below:

$ http --debug <COMPLETE ARGUMENT LIST THAT TRIGGERS THE ERROR>
<COMPLETE OUTPUT>

Additional information, screenshots, or code examples

@jackdeguest jackdeguest added bug Something isn't working new Needs triage. Comments are welcome! labels May 16, 2022
@isidentical
Copy link
Contributor

Thanks @jackdeguest, we will be looking for this one!

@arabcoders
Copy link

This is problem for downloaded content as well

@vermaxik
Copy link

vermaxik commented Apr 3, 2024

@isidentical any progress here? 🙏

Ousret added a commit to Ousret/httpie that referenced this issue Apr 4, 2024
@Ousret
Copy link
Collaborator

Ousret commented Apr 4, 2024

It's fixed in PR #1531
If you want to try it out: pip install "git+https://github.com/Ousret/HTTPie.git@feature-tryout-niquests" -U

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new Needs triage. Comments are welcome!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants