Search code examples
javascriptasciibarcode-scanner

Srip ascii-30 from barcode scanner input JavaScript


I am trying to use a DS9208 Scanner to allow users to scan their Drivers License to enter data into a kiosk. The scanning works fine but there is an ascii-30 in the data that is causing me problems.

Is there a way to use javascript strip the RS (ascii-30)(0x1f) code from the text that the scanner is sending before it gets to my html text area?


Solution

  • You can do .replace() to remove it. E.g.:

    scannedData.replace(String.fromCharCode(30), "")