question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect character count

See original GitHub issue

Count Characters script returns incorrect character count:

image

This originates from: https://github.com/IvanMathy/Boop/blob/5794294ef9a7f4e35e65c5008b47c1ec3733efd3/Boop/Boop/scripts/CountCharacters.js#L14

The implementation does not account for Unicode quirks which are described in detail here: https://mathiasbynens.be/notes/javascript-unicode#counting-symbols

Corrected implementation using string-length: https://runkit.com/embed/0q9svv0m85db

/cc @borna223 😉

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
IvanMathycommented, Sep 20, 2020

Hey there! Sorry about the very delayed response.

Digging more into the code you pasted it turns out it was taken from lodash, which is something that’s built in to Boop. I’m opening a PR right now to fix the issue, thank you so much for the help!

2reactions
IvanMathycommented, Jul 25, 2020

Hey there! Thanks for the report, looks like a bug indeed…

Feel free to put in a PR with a proposed solution, otherwise I’ll tackle it in 1.3.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my character count incorrect? - Stack Overflow
It says I have 6 words , when according to MS Word I'd have 4 . spaced-out and in. Gives me a word...
Read more >
How Does Character Count in Word Working? - NordicTrans
It's very uncommon that you the character count, but it's as easy as tracking word count, via ribbon's Review tab. Word automatically calculates...
Read more >
Character count incorrect when pasting data | Blazor Forums
We have considered the issue “Character count shows incorrect value when pasting content” as a bug from our end and the fix for...
Read more >
Character Count wrong · Issue #3849 · notepad-plus ... - GitHub
The character count in the summary reads it is counted without space, while in fact it also does count the spaces.
Read more >
Incorrect textarea character count on form validation in IE11
Hello, I have a textarea with a maxlength attribute within a form. I type text into that textarea until the max length is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found