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

MultipartFormData ContentHeaderEncoding UTF-8 #3754

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

apps4everyone
Copy link
Contributor

@apps4everyone apps4everyone commented Aug 1, 2023

Try to fix #3755

@jshier
Copy link
Contributor

jshier commented Aug 1, 2023

Thanks for the PR! Please follow the PR template to inform why you'd like to see this change and how applicable it is for all Alamofire users.

@apps4everyone apps4everyone marked this pull request as ready for review August 1, 2023 19:50
@apps4everyone
Copy link
Contributor Author

Thanks for the PR! Please follow the PR template to inform why you'd like to see this change and how applicable it is for all Alamofire users.

Thx for the quick reply, just opened a issues #3755 to describe the problem

@jshier
Copy link
Contributor

jshier commented Aug 9, 2023

I guess I don't understand the need here. UTF-8 is already used for the filename encoding we get the from the system, so why would a less capable encoding be necessary? And I'm not sure cString is an appropriate API to use here, as we aren't dealing with C strings in the first place.

Additionally, a change like this requires both updated documentation as well as tests. I can write the documentation if you can't, but tests are required as part of this change.

@jshier jshier changed the title feat: MultipartFormData ContentHeaderEncoding UTF-8 & iso-8859-1 MultipartFormData ContentHeaderEncoding UTF-8 & iso-8859-1 Aug 9, 2023
@apps4everyone
Copy link
Contributor Author

I guess I don't understand the need here. UTF-8 is already used for the filename encoding we get the from the system, so why would a less capable encoding be necessary? And I'm not sure cString is an appropriate API to use here, as we aren't dealing with C strings in the first place.

Additionally, a change like this requires both updated documentation as well as tests. I can write the documentation if you can't, but tests are required as part of this change.

Hey @jshier thx for the feedback and sorry for the late reply. Currently it look's like we use use iso-8859-1 by default and not UTF-8 for the MultipartFormData ContentHeaderEncoding. Maybe everywhere else but not for MultipartFormData. 🤔

if let fileName = fileName {
let encodingPrefix: String
if let encoding = encoding {
encodingPrefix = "*=\(encoding.rawValue)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GIST, optional encoding Info with one of:
*=UTF-8
default is without only
=

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it look's like its not the client but the server, the server falls back to iso-8859-1 if there is only =.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the server uses the UTF-8 String but only with iso-8859-1 char set so there are unknown characters. With *=UTF-8 we can tell the server explicitly that we are using UTF-8.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed iso-8859-1 and added some tests
the change is optional and does not change current behaviour

@apps4everyone apps4everyone changed the title MultipartFormData ContentHeaderEncoding UTF-8 & iso-8859-1 MultipartFormData ContentHeaderEncoding UTF-8 Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MultipartFormData ContentHeaderEncoding UTF-8
2 participants