Skip to content
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
Merged

Conversation

LordSk
Copy link
Member

@LordSk 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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright thanks @heinrich5991.

@oy oy merged commit f41bb0c into teeworlds:master Dec 21, 2018
@LordSk LordSk deleted the fix/broadcast_newline branch December 21, 2018 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants