I'm currently replacing characters 20, 21, 23, 24, 25, 26, 27, 28 and 30 into a combination of $chr(30) and a number, and the { [ ] " # $ % and } characters by characters 20, 21, 23, 24, 25, 26, 27, 28.
So no characters are getting lost, and $len doesn't change on the presence of { [ ] " # $ % and } characters, but it does on the 20, 21, 23, 24, 25, 26, 27, 28 and 30 characters. Keeping the correct length is not crucial, but I'd like to keep it if possible.