Open korsbo opened 3 years ago
I can't reproduce this
julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, icelake-client)
Environment:
JULIA_EDITOR = code.cmd
JULIA_NUM_THREADS = 8
julia> raw"foo\bar
baz"
"foo\\bar\nbaz"
julia> raw"foo\
bar
baz"
"foo\\\nbar\nbaz"
May depend on what kind of line endings your editor saves the file with. Might be possible to reproduce by printing and parsing directly in Julia. I also suspect it doesn't only happen on Windows, that's just the only platform where editors produce \r
line endings.
Yup:
julia> eval(Meta.parse("""raw"foo\\\rbar\rbaz\""""))
"foo\\\rbar\nbaz"
A raw-string is normally parsed to have Linux-style line endings,
\n
, even on Windows. Great! However, you get Windows-style line endings,\r\n
, if the linebreak in the raw-string is preceded by a backslash.