mmmm what I don't like of this approach is ```pos > temp.length-4``` is going to be true for any ```temp``` ending with an octal escapes shorter than 4 characters, which is wrong. Because of that, I kept checking ```encoded_dup[temp.length-1] != "\\"``` where ```encoded_dup.length > temp.length```. If there are remaining chars and the next chunk isn't starting with "\\" you know the current chunk should be cut.

As example:

Imagine a chunk like this one: ```\177\105\114\106\1\1\1\0``` Even if ```\0``` is a complete octal representation your approach is going to delete the last ```\0``` octal representation.