I am experiencing an unexpected bug in the following minimum-repro OtterScript:
set $literal = >-@>
this is line 1
this is line 2
this is line 3
>-@>;
Apply-Template(
Literal: $literal,
OutputFile: $PathCombine($SpecialWindowsPath(CommonApplicationData), none.txt)
);
Apply-Template(
Literal: $literal,
NewLines: Auto,
OutputFile: $PathCombine($SpecialWindowsPath(CommonApplicationData), auto.txt)
);
Apply-Template(
Literal: $literal,
NewLines: Windows,
OutputFile: $PathCombine($SpecialWindowsPath(CommonApplicationData), windows.txt)
);
Apply-Template(
Literal: $literal,
NewLines: Linux,
OutputFile: $PathCombine($SpecialWindowsPath(CommonApplicationData), linux.txt)
);
When run against localhost (a Windows server), the resulting files appear to be created with additonal \r chars in between each line:

I was expecting that, for NewLines: Windows, the byte-sequence for line-endings would be \r\n and for NewLines: Linux, the byte-sequence would be \n. Instead, I appear to have \r\r\n and \r\n.
(I assume not specifying is the same as Auto, and matches the Windows behaviour because of the target server's platform. I have not tried against a Linux target server.)
Note that I am not referring to the ones at the top and bottom of the resulting files -- those are clearly because I have written newlines before and after my fish-quotes. Nor the spaces at the start of each line, those also exist in the fish-string.
The script was entered via the /scripts/edit2 text editor rather than /osve.
Have I misunderstood some nuance of the Apply-Template function, or fish-strings in general, or is this a bug?
PS: I thought I might work around this with...
Apply-Template
(
OutputVariable => $out,
Literal: $literal,
NewLines: Windows
);
set $linux_out = $RegexReplace($out, "[\r]+\n", "`n");
Log-Debug $linux_out;
set $win_out = $RegexReplace($out, "[\r]+\n", "`r`n");
Log-Debug $win_out;
Create-File
(
Name: $PathCombine($SpecialWindowsPath(CommonApplicationData), linux_pp.txt),
Text: $linux_out,
Overwrite: true
);
Create-File
(
Name: $PathCombine($SpecialWindowsPath(CommonApplicationData), windows_pp.txt),
Text: $win_out,
Overwrite: true
);
...but it appears that Create-File has its own nuance, and all were turned into \r\n newlines. I assume, therefore, it is not possible to use Create-File to create a raw file containing the exact content of a variable, with no pre-processing?
Version 2022.10 (Build 1)