Character count bug
-
I believe that when there is a “–” character it is not counted.
It is not the “hyphen”, it is the “dash”For example, as the counting in the software is shown:
EITHALOG LOGISTICA E TRANSPORTES EI = 35 characters
EITHALO- LOGISTICA E TRANSPORTES EI = 35 characters
EITHALO– LOGISTICA E TRANSPORTES EI = 34 charactersIf you copy and paste from the forum, it does not show the error, so I’m making a file available for viewing.
It is a file that is generated automatically through a logistic control software.
https://www.dropbox.com/s/6bl5951wf6faaep/Notepad%2B%2B.zip?dl=0
-
you are correct, and it looks like more chars are affected - every char within 0x80 and 0xBF.
But if you use “convert to utf-8”, than it is correctly counted.
The issue seems to be in ScintillaEditView.hlong getUnicodeSelectedLength() const { // return -1 if it's multi-selection or rectangle selection if ((execute(SCI_GETSELECTIONS) > 1) || execute(SCI_SELECTIONISRECTANGLE)) return -1; auto size_selected = execute(SCI_GETSELTEXT); char *selected = new char[size_selected + 1]; execute(SCI_GETSELTEXT, 0, reinterpret_cast<LPARAM>(selected)); char *c = selected; long length = 0; while(*c != '\0') { if( (*c & 0xC0) != 0x80) ++length; ++c; } delete [] selected; return length; }
but I’m unsure why this is done.
Cheers
Claudia