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

Comments

Projects
None yet
2 participants
@mathiasbynens

mathiasbynens commented Mar 18, 2013

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

This comment has been minimized.

Show comment
Hide comment
@RadLikeWhoa

RadLikeWhoa Mar 20, 2013

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.

Owner

RadLikeWhoa commented Mar 20, 2013

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

This comment has been minimized.

Show comment
Hide comment
@mathiasbynens

mathiasbynens Mar 22, 2013

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.

mathiasbynens commented Mar 22, 2013

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

Marcus Wilson
Resolves Issue RadLikeWhoa#9 Issue RadLikeWhoa#11 Issue RadLikeWhoa#12
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/

@RadLikeWhoa RadLikeWhoa closed this May 2, 2013

@mathiasbynens

This comment has been minimized.

Show comment
Hide comment
@mathiasbynens

mathiasbynens commented May 2, 2013

Awesome!

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