'non-printable' characters, eh? So they're not actually spaces, it would seem. What does a quick peek with a hex editor at the XML reveal is really there?
Will you get the following output? No. Argh! It always helps to give as complete a description of what you need to do as possible from the beginning. It will cut down on the amount of thrashing people trying to help you will go through. Your examples show that neither of the two techniques I listed...
Double-click on the routine to examine the source code. You'll need to use the 'Concurrent' version instead if others will be needing sequences for the same table at the same time.
Which will allow you to read them and thus they will no longer be 'bad'. You can still check the field for terminators after the fact and logically reject them if you like.