I'm writing a barcode application whereby the user has the ability to specify a list of termination characters to be transmitted with each barcode. Consider the following:
<input id="terminators" type="text" value="\n" />
The trouble is when I retrieve the value from the input, the escape sequence
\n is returned as two individual characters
n. Whereas I need it as one
\n ASCII character 10.
You can reproduce this issue in your browsers console using the following code:
document.getElementById('terminators').value.charCodeAt(0) === '\n'.charCodeAt(0)