Compare these two images:
My comments appear to be exactly the same as far as the text body goes. However the first image shows that I have 584 characters left to put in my comment, and yet refuses to post. The second image shows that I have 9 more characters to go before being able to post this comment.
The sorcery that comes into play here is the famous ZWSP (Zero-Width Space) character. On the first image I inserted enough of them to trick the character count into thinking that there was actually enough text there, so it started counting down the remaining characters.
It however wont let me post this as a comment (for obvious reasons).
This is not a duplicate of Comment character counter does not trim, while the server does. That is a bug report that was status-declined by The Great Jeff Atwood himself; this is a feature request to reconsider that decision.
You could say that is the end of it all. But...
This gets brought up again and again and again and again. And probably there are a lot more deleted posts as well.
Obviously it has people fooled every now and then, as it just fooled me today. I find it very confusing to see a character count, which is later contradicted with an error message.
Can we make both character counts, the number of characters remaining/to go and the one for the error message, correspond?
As a comment on the canonical question points out adding .trim()
in the code would most likely suffice. This would still leave one error remaining, that of stripped @replies, but that is a whole different regex I'm not demanding to be slain.