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

Character encoding for the application/x-www-form-urlencoded format #167

Open
adeinega opened this issue Jan 22, 2024 · 1 comment
Open
Labels
editorial This issue does not affect existing implementations

Comments

@adeinega
Copy link
Contributor

adeinega commented Jan 22, 2024

Section 3.2.2 Tokens states that

The client makes a request to the token endpoint by sending the
following parameters using the application/x-www-form-urlencoded
format per Appendix B with a character encoding of UTF-8 in the HTTP
request content:

However, the following example does not include UTF-8 as character encoding

POST /token HTTP/1.1
Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded

it should look like as

POST /token HTTP/1.1
Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;

the same applies for all other similar examples in the spec.

How is this important? In some (rare) cases, it can lead to interoperability issues as app servers & frameworks that run an AS do not necessarily use "UTF-8" as a default encoding character, as an example, Java Servlets use "ISO-8859-1". So, it is better for a client to always specify the character explicitly.

@aaronpk aaronpk added the editorial This issue does not affect existing implementations label May 11, 2024
@aaronpk
Copy link
Member

aaronpk commented Nov 15, 2024

From what I can tell, the application/x-www-form-urlencoded content type implies UTF-8 encoding, so it is not needed to include the charset.

https://url.spec.whatwg.org/#application/x-www-form-urlencoded

https://url.spec.whatwg.org/#application/x-www-form-urlencoded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial This issue does not affect existing implementations
Projects
None yet
Development

No branches or pull requests

2 participants