Skip to content

Add options for which case to use in Base functions #2408

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

Merged
merged 1 commit into from
Jun 16, 2014

Conversation

ericmj
Copy link
Member

@ericmj ericmj commented Jun 16, 2014

No description provided.

@pma
Copy link
Contributor

pma commented Jun 16, 2014

+1 for lowercase. I'm using Base.encode16(string) |> String.downcase almost all the time, just because I think lowercase hex "looks" better.

Regarding the way we pass the lowercase option, please consider that other options may be required in the future. Many encoding libs also include options to omit the padding in Base64/Base32 or to set a padding char different than ?=. One option is to use a keyword list as mentioned in #2143.

Allowing mixed case when decoding should be avoided in my opinion. We can always do a previous String.downcase/upcase if we really want the mixed case behaviour. But as stated in chapter 12 of the rfc (http://tools.ietf.org/html/rfc4648#page-14) there are security implications.

@josevalim
Copy link
Member

👍 for making the case an option instead of an atom: case: :lower. @ericmj can you please amend?

@ericmj
Copy link
Member Author

ericmj commented Jun 16, 2014

Pushed with discussed changes.

josevalim pushed a commit that referenced this pull request Jun 16, 2014
Add options for which case to use in Base functions
@josevalim josevalim merged commit b126e3b into elixir-lang:master Jun 16, 2014
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

@ericmj ericmj deleted the base-case branch June 5, 2019 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants