Handle embedded newlines in C strings correctly