Closed mathiasbynens closed 11 years ago
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.
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.
Awesome!
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.