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

Count symbols/code points more accurately #9

Closed
mathiasbynens opened this issue Mar 18, 2013 · 3 comments
Closed

Count symbols/code points more accurately #9

mathiasbynens opened this issue Mar 18, 2013 · 3 comments

Comments

@mathiasbynens
Copy link

See http://pastebin.com/raw.php?i=bZ7dbreC for some example characters that get miscounted. (GitHub won’t let me post them here.)

Perhaps this can help: http://mathiasbynens.be/notes/javascript-encoding It explains the problem in more detail and also offers a solution. You could use Punycode.js to make it really easy.

@RadLikeWhoa
Copy link
Owner

Thanks for the suggestion, but I'd rather keep Countable as lightweight as possible. I see the problem and your explanation cleared up a lot, but to me the issue seems not that bad, actually. I checked with some other tools (e.g. Google Docs) and most counted symbols as two characters as well.

@mathiasbynens
Copy link
Author

I checked with some other tools (e.g. Google Docs) and most counted symbols as two characters as well.

Just because other software exhibits the same bug doesn’t mean that it’s not an issue.

Thanks for the suggestion, but I'd rather keep Countable as lightweight as possible.

This is not an argument either. Fixing it (even without a third-party library) would just take a few lines of code.


From the README:

Countable is a JavaScript function to add live paragraph-, word- and character-counting to an HTML element.

It just seems weird to me that a single-purpose JavaScript library fails at the only task it’s supposed to perform — especially when it can so easily be fixed.

@RadLikeWhoa RadLikeWhoa reopened this Mar 22, 2013
craniumslows pushed a commit to craniumslows/Countable that referenced this issue May 1, 2013
I needed to get my mind off of work so I went ahead and fixed the 3
open issues. You can check it out at

http://jsfiddle.net/j6nkw/3/
@mathiasbynens
Copy link
Author

Awesome!

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