[RFC] Fix newline substitution causing abort

Initial solution for #1529. Proper solution should be further discussed there.

As explained there, this is one of two possible solutions, that should have to be discussed. 
But, in the meantime, it's requested for this to be merged so that master doesn't abort in that case.
:+1: