IMO the "better" attack here is to just kind of use Return Oriented Programming (ROP) to build the nefarious string. I'm not going to do the example with the real thing, for the example let's assume the malicious string is "foobar". You create a list of strings that contain the information somewhere:
const dictionary = ["barcode", "moon", "fart"];
const payload = [ [2, 0, 1], [1, 1, 2], [0, 0, 3] ];