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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

code_to_flag behaves weirdly with lowercase country codes #1

Closed
juliuste opened this issue Apr 2, 2021 · 2 comments
Closed

code_to_flag behaves weirdly with lowercase country codes #1

juliuste opened this issue Apr 2, 2021 · 2 comments

Comments

@juliuste
Copy link

juliuste commented Apr 2, 2021

Hey 馃檪 Thank you very much for providing this useful library! I noticed some unintuitive behaviour in the code_to_flag function, when supplying a country code in lowercase:

let correct = country_emoji::code_to_flag("DE"); // as_bytes returns [240, 159, 135, 169, 240, 159, 135, 170]
let incorrect = country_emoji::code_to_flag("de"); // as_bytes returns [240, 159, 136, 137, 240, 159, 136, 138]

I guess this happens because code_to_flag, unlike most other functions, doesn't use .to_uppercase() to normalize the input.

Expected behaviour

I'd either expect all methods to return None for lowercase codes, or the code_to_flag function to return the correct flag even when supplying a lowercase country code.

I'm happy to work on a fix for the problem if you don't have the time, but I'd need to know which behaviour you'd prefer.

@leodutra
Copy link
Owner

leodutra commented Nov 27, 2021

This should be fixed now on 0.2.0. The next version will include minimal testing.

@leodutra
Copy link
Owner

I'll close it, for now. Feel free to reopen if you have any issues.

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