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

Body encoding now applied and always defaults to UTF-8 #25

Merged
merged 3 commits into from
Aug 14, 2022

Conversation

lread
Copy link
Collaborator

@lread lread commented Aug 13, 2022

Was previously always encoding to system default character encoding,
which is UTF-8 unless on Windows then it is windows-1252.

Now:

  • encoding body to requested body encoding
  • and defaulting to UTF-8 if no body encoding is requested

Also:

  • Added extended characters to http bodies in tests to exercise
    body encoding/decoding
  • Verified :auto body decoding with an extra test

Note that :auto body decoding might not be entirely correct.
It will only look at content-type charset if content-type starts with
"text/". Diagnosing/fixing this is out of scope for this PR.

Fixes #18

lread added 2 commits August 13, 2022 16:08
Was previously always encoding to system default character encoding,
which is UTF-8 unless on Windows then it is windows-1252.

Now:
- encoding body to requested body encoding
- and defaulting to UTF-8 if no body encoding requested

Also:
- Added extended characters to http bodies in tests to exercise
body encoding/decoding
- Verified :auto body decoding with an extra test

Note that :auto body decoding might not be entirely correct.
It will only look at content-type charset if content-type starts with
"text/". Diagnosing/fixing this is out of scope for this PR.

Fixes clj-commons#18
CHANGELOG.md Outdated Show resolved Hide resolved
@borkdude
Copy link
Collaborator

Apart from the typo, LGTM. Feel free to merger after the typo fix.

@lread
Copy link
Collaborator Author

lread commented Aug 14, 2022

Thanks for the review! I'm having typo-blindness. Maybe it is just poorly worded?

Maybe instead: If specified, body encoding is now applied, else defaults to UTF-8.

I'll try that and maybe you can lemme know if there is still something amiss.

@lread lread changed the title Body encoding now always defaults to UTF-8 Body encoding now applied and always defaults to UTF-8 Aug 14, 2022
@lread
Copy link
Collaborator Author

lread commented Aug 14, 2022

For posterity, I had misspelled "respects"! Couldn't see it! Thanks @borkdude!

@lread lread merged commit da0e634 into clj-commons:master Aug 14, 2022
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.

When :body is string it is encoded using platform default encoding
2 participants