-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
File name encoding cannot be set when uploading files #4218
Comments
Can you please provide me with the full traceback that occurs when you encode with cp1251? |
I read the code, and Requests calls urllib3, but urllib3 seems to accept only STR, not bytes. If I pass the string in, it will encode the filename with UTF-8, but my server doesn't recognize the code. So I don't think it's a bug. I would be happy if I could encode my own file name |
Hrm. The server really should recognise it. However, urllib3 should also allow you to provide your own bytes, so I think you should raise this as a urllib3 bug. |
I've spent some time with this (related #2117, #2217), where I needed to post utf-8 encoded filename to a confluence server. The issue being that confluence does not recognise the I found the solution in RFC2047, by encoding the filename to only ascii printables, and thus sending it in the old standard python code to encoding unicode filename to such a string:
Would be nice if this could somehow be provided as a feature in requests (that is, an option wether to use |
Hi. Have you been able to solve this problem? The server I work with also accepts windows-1251 encoding only and when I upload files their names become corrupt. Thanks. |
In an effort to clean up the issue tracker to only have issues that are still relevant to the project we've done a quick pass and decided this issue may no longer be relevant for a variety of potential reasons, including:
If you think the issue should remain open, please comment so below or open a new issue and link back to the original issue. Again, thank you for opening the issue and for the discussion, it's much appreciated. |
Summary.
The server code is windows-1251, and the program file code is UTF-8. When I upload the file, the file name obtained by the server is garbled. File name cannot be encoded as windows-1251, otherwise an exception will be thrown.
Expected Result
the file name obtained by the server is normal
Actual Result
the file name obtained by the server is garbled.
Reproduction Steps
System Information
This command is only available on Requests v2.16.4 and greater. Otherwise,
please provide some basic information about your system (Python version,
operating system, &c).
The text was updated successfully, but these errors were encountered: