those characters are, by definition, non-printing characters. they serve other purposes,
but they are certainly part of the byte stream. and you don't need me to tell you what
you already see: textchanged may or may not behave as you expect.
the os interprets these low ascii values as control characters. chr(10) might involve
moving a cursor to a new line (of text). it might involve unsetting the view's focus. it
might be part of a stream of bytes, which when placed in the context of "lines of text"
causes a linefeed in between each "line". but, in such a context, the lines would not
include the chr(10). in common usage, a string of text doesn't end with chr(10).
end of input, however, may be signalled by chr(10) which is not going to be included
in the string. and a string of bytes can terminate with chr(10) (but if you look at those
bytes in a text context, the chr(10) will be dealt with as the os determines in that
context.
dim bytes() as byte = barcode.getbytes("ISO8859-1")
gets you your bytes.
agraham's byteconverter library will allow you to print those values as a hex string:
log(bc.StringFromBytes(bytes, "ISO8859-1"))
technically, UTF8 should work, but things depend on the symbology your scanner is looking at.
by the way, once you have determined that the barcode actually ends with chr(10), then you just drop it. you don't have to go through all the stuff you had:
dim fixedbarcode as string = originalbarcode.substring2(0,originalbarcode.length - 1)
also if define a string as "12345" & crlf, its length is 6, even though you can't see the crlf. but you can remove it. depending on the contect in which you place this string, it may have already been seen and dealt with by the os.