New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcast: parse new line character #1912

Merged
merged 2 commits into from Dec 21, 2018

Conversation

Projects
None yet
3 participants
@LordSk
Copy link
Member

LordSk commented Dec 21, 2018

This had unintended behaviour, it was only parsed by the text function at the end and thus would cause the text to be mis-positioned. The new line character can only be sent via code modification so this was only an issue for mods.

image

"Sometext\nOOP new ^900LINE\\nAnother ^090one"

@@ -315,6 +315,16 @@ void CBroadcast::OnMessage(int MsgType, void* pRawMsg)
}
}

if(*c == CharUtf8 && *c == '\n')

This comment has been minimized.

@heinrich5991

heinrich5991 Dec 21, 2018

Contributor

*c == CharUtf8 is unnecessary, the '\n' is always a literal \n in UTF-8:

From UTF-8 on Wikipedia:

The first 128 characters of Unicode, which correspond one-to-one with ASCII, are encoded using a single octet with the same binary value as ASCII, so that valid ASCII text is valid UTF-8-encoded Unicode as well. Since ASCII bytes do not occur when encoding non-ASCII code points into UTF-8, UTF-8 is safe to use within most programming and document languages that interpret certain ASCII characters in a special way, such as "/" in filenames, "" in escape sequences, and "%" in printf.

This comment has been minimized.

@LordSk

LordSk Dec 21, 2018

Member

Alright thanks @heinrich5991.

@oy oy merged commit f41bb0c into teeworlds:master Dec 21, 2018

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@LordSk LordSk deleted the LordSk:fix/broadcast_newline branch Dec 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment