Hi,
from only having a code snippet it’s hard to say.
But most often such issues happen when a buffer (=memory / variable) is used more then once but isn’t initialized before next usage.
So I would propose to clear (= overwrite with 0) all buffers before re-usage, for example “file_read_buffer” with “brsmemset(ADR(file_read_buffer), 0, SIZEOF(file_read_buffer))” or similar … because I assume, that the extra / unwanted characters are fragments from a “before-usage” of the buffers with a longer content in addition with a missing string termination (= 0 at the end of the string length) at the end of the new content.
Best regards!