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

Allow specific character encoding for the request body #10

Closed
relentless opened this issue Jan 2, 2014 · 5 comments
Closed

Allow specific character encoding for the request body #10

relentless opened this issue Jan 2, 2014 · 5 comments

Comments

@relentless
Copy link
Collaborator

The character encoding used when reading the response can be specified, but the body of the request always gets encoded with windows-1252. The user should be able to specify which encoding they want to use, either with an optional parameter on the withBody function or a new function like 'withRequestCharacterEncoding'

@ovatsus
Copy link

ovatsus commented Mar 3, 2014

Why is windows-1252 the default and not utf8?

@relentless
Copy link
Collaborator Author

It was just what was used on wherever I got that code from in the first place (MSDN or something). I'll think about it properly when this issue gets implemented. The response defaults to ISO-8859-1, which from what I understand is the HTTP 1.1 default, so I guess it would be that or UTF-8. I take it you think UTF-8's the way to go?

@ovatsus
Copy link

ovatsus commented Mar 3, 2014

I always saw UTF8 used everywhere, but it's possible it's not the correct default, just wondering if you found that in any http spec, I couldn't find any info

@relentless
Copy link
Collaborator Author

In http://www.ietf.org/rfc/rfc2616.txt, sections 3.7.1 & 14.2 discuss ISO-8859-1 being the default encoding text-based types, but that's about the response. I can't see the request body specifically mentioned.

http://stackoverflow.com/a/708942/368134 says the default for a POST body is ISO-8859-1, although I couldn't see that in either of the resources he linked to. So I'm really not sure. Let me know if you find anything definitive!

A related point, while the HTTP specs state accept-charset 'can be used to indicate what character sets are acceptable for the response', the HTML 4.01 specs (http://www.w3.org/TR/html401/interact/forms.html#adef-accept-charset) states 'This attribute specifies the list of character encodings for input data that is accepted by the server processing this form.'

@relentless
Copy link
Collaborator Author

added withBodyEncoded

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

No branches or pull requests

2 participants