New line doesn't respect carriage returns.
Moderocky opened this issue ยท 0 comments
Bug Description
The new line literal is always LF
(line feed) regardless of operating system.
Text coming from an operating system that uses CRLF
(carriage return line feed) could become input for Skript somewhere.
This means that you can always detect/replace the \n
part of a new line, but it might also have an \r
part as well, so find-and-replacing new lines in hello\r\nthere
would leave you with hello\rthere
rather than hellothere
, meaning Skript could produce inconsistent results with some input (maybe OS-dependent).
Now we don't want to use the operating system new line obviously, because Minecraft players don't want to be sent messages with CRLF, but we probably need to fix this in stuff like contains/equals/replace.
Ideally, we'd use regex's \\n
token everywhere suitable, which matches all kinds of new lines, but we can also just check it against \r\n
as well as \n
.