Error with newlines from barcode scanner



  • I happily use NP++ for everything instead of ms notepad (ugh), but now I am getting strange errors when using a barcode scanner. When testing a barcode scanner on a Code39 type barcode with check digit, content is “CODE39W” where W is the check digit, and where the scanner is set to append a newline after each scan, I expect this output:

    CODE39
    CODE39
    CODE39

    Indeed, with ms Notepad this works just fine. However, with NP++, I see this strange output:

    CODE39
    CODE39CODE39
    CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39
    CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39CODE39

    So this is what happens. The first scan is OK. The second scan is missing the newline, so two scans appear on the same line. Then 3 scans appear on one line. Then 4, 5, etc up to 12 scans on one line. Then the output is “stable” with 12 scans on one line.

    It does not matter if I scan several times rapidly, or take a pause of a few seconds between two scans.

    I suspected something wrong with my NP++ installation, version 7.8.2 on Windows 7 Professional (yes, I know, obsolete, but in this office I am stuck with it). So I closed the application, downloaded 7.8.3 for 64bit, installed, said Yes on the question of removing the old 7.8.2.

    With the new, fresh, 7.8.3, the exact same strange output!!

    My question is: what is going on here with NP++, is this a known bug, and why does ms Notepad work just fine?



  • @Ict-MylabDev

    I would turn this option on and you may get more information about what is going on:

    View > Show Symbol > Show All Characters



  • View All Symbols did not show anything surprising.

    But a colleague suspected a preference setting. We tried some, and found that turning off “Enable auto-completion on each input” solved the problem.

    I have no idea what this feature is doing exactly. It might well be that this particular barcode text triggered the auto-completion. Anyway, I can close the ms Notepad window and continue work with NP++ :-)



  • @Ict-MylabDev said in Error with newlines from barcode scanner:

    turning off “Enable auto-completion on each input” solved the problem

    LOL. That makes perfect sense. I can’t stand “Auto-completion” being turned on, so that kind of thing never occurred to me for your problem.



  • @Ict-MylabDev said in Error with newlines from barcode scanner:

    found that turning off “Enable auto-completion on each input” solved the problem.
    I have no idea what this feature is doing exactly.

    Specifically, what is happening: as you continue to scan CODE39 with the barcode scanner, it is typing C O D E 3 9 EOL. With autocompletion turned on, the first time through, Notepad++ auto-complete doesn’t do anything (nothing to autocomplete, because it’s never seen that before). The second time, after n characters from CODE39, the autocompletion mini-window appears (because it recognized the start of CODE39, which it has now previously seen), and it keeps matching as the scanner types the remainder of CODE39; the EOL at the end of the barcode scan, instead of inserting a newline in Notepad++, is used to select the active word from autocomplete, so it just leaves CODE39 but stays on the same line. The third barcode scan starts on that second line, but since it’s extended the text beyond CODE39 to CODE39C..., it isn’t matching, so the third EOL goes to Notepad++, to move the cursor to the third line. Similar sequences occur on future rows, which explains why it grows for a while. Apparently, it hits a maximum length for autocomplete on the 12th line, hence it just stays the same length, because it listens to that lase EOL on that line.

    (This can be replicated on your own without a barcode scanner by just turning on the autocomplete, and typing (not just pasting) CODE39 followed by a newline many times.)


Log in to reply