- Jul
- 534
- 10
How can I accurately measure the width of a string, if %@LEN[] returns 1 for double-wide characters?
I stumbled upon this “bug” when i noticed the code to wrap long lines on my bigecho.bat (echo but in double-height) was wrapping incorrectly.
Notice the dropped "O" in Others.
The more emoji I put into the line, the worse it got:
Eventually I realize, it was undercounting the emoji’s length, because it was counting it as one character, even though, at least visually, it’s length (width) is 2.
Is there some easy way around this?
I stumbled upon this “bug” when i noticed the code to wrap long lines on my bigecho.bat (echo but in double-height) was wrapping incorrectly.
Notice the dropped "O" in Others.
The more emoji I put into the line, the worse it got:
Eventually I realize, it was undercounting the emoji’s length, because it was counting it as one character, even though, at least visually, it’s length (width) is 2.
Is there some easy way around this?