Bug introduced in 8.0 or earlier and persisting through 11.1
When saving notebooks, the Front End destroys "\r"
appearing in code and converts it to "\n"
. Here are minimal steps to reproduce the issue:
Enter this in a notebook, then evaluate it:
DynamicModule[{}, "Empty", Initialization :> "\r\n" ]
Save the notebook.
Open the notebook in a text editor and look at its expression. I see
Initialization:>"\n\n"
The
\r
has been changed to an\n
.
I observe this on OS X with M9.0.1–M11.1.0. Do other people see it? Is it a bug? Is there a simple workaround?
In my actual use case, I have StringReplace[..., {"\r\n" -> "\n", "\r" -> "\n"}]
in Initialization
. This gets mangled and made non-functional by this problem.
Reported as CASE:3873908.