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

Counting characters #12

Open
betatim opened this issue Oct 10, 2016 · 1 comment
Open

Counting characters #12

betatim opened this issue Oct 10, 2016 · 1 comment

Comments

@betatim
Copy link
Member

betatim commented Oct 10, 2016

Need to do better at counting characters. It is all about the unicode!

For example 'Laâyoune-Sakia El Hamra ⵍⵄⵢⵓⵏ-ⵙⴰⵇⵢⴰ ⵍⵃⴰⵎⵔⴰ العيون-الساقية الحمراء, Western Sahara' is 81 characters but if you encode it properly: len(unicodedata.normalize("NFC", 'Laâyoune-Sakia El Hamra ⵍⵄⵢⵓⵏ-ⵙⴰⵇⵢⴰ ⵍⵃⴰⵎⵔⴰ العيون-الساقية الحمراء, Western Sahara').encode('utf-8')) it is 134 "characters"

@betatim
Copy link
Member Author

betatim commented Oct 10, 2016

The hardest part is working out how to shorten things. Often (I think) the unicode version is the local spelling of the english version.

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

1 participant