PS2EXE icon indicating copy to clipboard operation
PS2EXE copied to clipboard

Multiline strings change line returns

Open justinledwards opened this issue 2 years ago • 2 comments

If I run the script I get no errors from a program that is expecting LF returns in the data, but when running it after converting through PS2EXE I get a parsing error showing the line return is changed into a carriage return.

TLDR; It seems that LF gets changes to CRLF in multiline strings.
multiline string defined using

@" multi line "@

I'm going to try to figure out a workaround, but wanted to put the issue in here in case it ever happens to someone else.

justinledwards avatar Apr 13 '22 20:04 justinledwards

Workaround is that you can use `n on a single line string to do new line returns. If you also need double quotes inside the multiline string you can escape them with `"

justinledwards avatar Apr 13 '22 20:04 justinledwards

Hello @justinledwards;

I do not see any issue here. We're on Windows, CRLF is the standard for a new line marker. Only LF is Unix-type.

And what is "the data", and what is "a program"?

Greetings

Markus

MScholtes avatar Apr 14 '22 14:04 MScholtes

Closed since no reaction

MScholtes avatar Sep 13 '22 16:09 MScholtes

This can stay closed, I was just cleaning out my alerts.

I was making metrics for prometheus. It required the new lines to be LF, the powershell script itself processed the newlines, but when converted to an exe it lost the formatting. I eventually rewrote what I was doing in C#. It was quite the edge case that probably wouldn't be encountered again.

justinledwards avatar Feb 01 '23 18:02 justinledwards