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

toCode and fromCode should be inverse operations #174

Closed
TheSeamau5 opened this Issue Feb 16, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@TheSeamau5
Contributor

TheSeamau5 commented Feb 16, 2015

So, I saw that toCode and fromCode are not inverse operations. According to the docs, toCode uppercases things for use with the keyboard. I think that this makes no sense. If you really want a function to work to the keyboard, there should be one called toKeyboardCode because from the names, it would seem that toCode and fromCode are inverses.

I found this out as I was testing the core library with elm-check and with this property:

property "Converting to Unicode and back" (\c -> Char.fromCode (Char.toCode c) == c) generator

I got the following errors:

Converting to Unicode and back has failed with the following input: "z"
Converting to Unicode and back has failed with the following input: "ú"
Converting to Unicode and back has failed with the following input: "ő"
Converting to Unicode and back has failed with the following input: "ɀ"
Converting to Unicode and back has failed with the following input: "ɡ"
Converting to Unicode and back has failed with the following input: "ͅ"
Converting to Unicode and back has failed with the following input: "α"
Converting to Unicode and back has failed with the following input: "ё"
Converting to Unicode and back has failed with the following input: "ԑ"
Converting to Unicode and back has failed with the following input: "հ"
Converting to Unicode and back has failed with the following input: "ᵹ"
Converting to Unicode and back has failed with the following input: "ṑ"
Converting to Unicode and back has failed with the following input: "ὑ"
Converting to Unicode and back has failed with the following input: "ⅰ"
Converting to Unicode and back has failed with the following input: "ⓠ"
Converting to Unicode and back has failed with the following input: "ⱀ"
Converting to Unicode and back has failed with the following input: "ⱡ"
Converting to Unicode and back has failed with the following input: "ⳑ"
Converting to Unicode and back has failed with the following input: "ⴑ"
Converting to Unicode and back has failed with the following input: "ꙑ"
Converting to Unicode and back has failed with the following input: "ꜧ"
Converting to Unicode and back has failed with the following input: "ff"
Converting to Unicode and back has failed with the following input: "z"
Converting to Unicode and back has failed with the following input: "z"
Converting to Unicode and back has failed with the following input: "ú"
Converting to Unicode and back has failed with the following input: "đ"
Converting to Unicode and back has failed with the following input: "ő"
Converting to Unicode and back has failed with the following input: "ơ"
Converting to Unicode and back has failed with the following input: "ǡ"
Converting to Unicode and back has failed with the following input: "ʀ"
Converting to Unicode and back has failed with the following input: "ͅ"
Converting to Unicode and back has failed with the following input: "ΐ"
Converting to Unicode and back has failed with the following input: "α"
Converting to Unicode and back has failed with the following input: "а"
Converting to Unicode and back has failed with the following input: "ѡ"
Converting to Unicode and back has failed with the following input: "ґ"
Converting to Unicode and back has failed with the following input: "ⅰ"
Converting to Unicode and back has failed with the following input: "ꞗ"
Converting to Unicode and back has failed with the following input: "z"
Converting to Unicode and back has failed with the following input: "đ"
Converting to Unicode and back has failed with the following input: "ԫ"
Converting to Unicode and back has failed with the following input: "ԫ"

Notice how it fails with the letter z (the first input in the sequence).

@deadfoxygrandpa

This comment has been minimized.

Show comment
Hide comment
@deadfoxygrandpa

deadfoxygrandpa Feb 21, 2015

Contributor

I'd really like a toCode that doesn't convert to uppercase, at least as an option. I'm right now trying to write a text rendering thing in elm-webgl and all my text comes out uppercase all the time because of this.

Contributor

deadfoxygrandpa commented Feb 21, 2015

I'd really like a toCode that doesn't convert to uppercase, at least as an option. I'm right now trying to write a text rendering thing in elm-webgl and all my text comes out uppercase all the time because of this.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Feb 21, 2015

Member

I believe the upper-casing is removed on the master branch, not sure if that resolves all of this.

Member

evancz commented Feb 21, 2015

I believe the upper-casing is removed on the master branch, not sure if that resolves all of this.

@TheSeamau5

This comment has been minimized.

Show comment
Hide comment
@TheSeamau5

TheSeamau5 Feb 22, 2015

Contributor

https://github.com/elm-lang/core/pull/134 solved this problem. toCode now doesn't convert to uppercase which is exactly what we wanted and how it should've been and now all is good. 😄

Contributor

TheSeamau5 commented Feb 22, 2015

https://github.com/elm-lang/core/pull/134 solved this problem. toCode now doesn't convert to uppercase which is exactly what we wanted and how it should've been and now all is good. 😄

@TheSeamau5 TheSeamau5 closed this Feb 22, 2015

@kasbah

This comment has been minimized.

Show comment
Hide comment
@kasbah

kasbah Feb 22, 2015

Contributor

Don't you mean #50 solves this problem?

Contributor

kasbah commented Feb 22, 2015

Don't you mean #50 solves this problem?

@TheSeamau5

This comment has been minimized.

Show comment
Hide comment
@TheSeamau5

TheSeamau5 Feb 22, 2015

Contributor

Probably. I just saw that the problem was solved in the merged PR and was super happy so I closed it. I didn't look too much into the history behind the fix, sorry.

Contributor

TheSeamau5 commented Feb 22, 2015

Probably. I just saw that the problem was solved in the merged PR and was super happy so I closed it. I didn't look too much into the history behind the fix, sorry.

@kasbah

This comment has been minimized.

Show comment
Hide comment
@kasbah

kasbah Feb 22, 2015

Contributor

No worries, but I think it would be clearer to report bugs against the master branch if you are able.

Contributor

kasbah commented Feb 22, 2015

No worries, but I think it would be clearer to report bugs against the master branch if you are able.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment