Subscribe
Notify of
7 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
ohwehohach
2 years ago

No. HTML, or rather the browser that interprets HTML, doesn't really care about the string "\n". A line break in HTML is created with <br />. But if the web form was programmed by someone who hasn't been living on a brick wall for the last 20 years, it will be filtered out anyway, as will any attempts to enter HTML tags.

In addition, entering "\n" would be interpreted as plain text anyway and thus delivered as "\\n" in the backend, so it would not have the function of a control character anyway.

Functional
2 years ago

No. To create a line break in HTML, you need a <br> tag. But if you try to change your username to "Max<br>John" somewhere, there's a very high probability that the <br> tag will either be filtered out, the username won't be accepted at all, or your username will actually be "Max<br>John" and not "Max

Mustermann" because the <br> tag is escaped. If this isn't the case, the website was probably developed by a freshman computer science student, and you shouldn't use it anyway.

jort93
2 years ago

This is usually escaped when creating the username.

Not to mention that this is not a line break in HTML.

Mathmaninoff, UserMod Light

Often, you can't insert any special characters at all. Otherwise, if something is well programmed, it shouldn't be there. User input is sanitized before it's displayed. Otherwise, you could embed some malicious script in the same way, for example, that steals data from others, redirects to phishing sites, or tries to install viruses as soon as someone sees your name.

By the way, in HTML it's <br>. In JavaScript it would be \n.

When you type something into a normal text field, a "\n" in the string automatically becomes a "\\n".

PeterP58
2 years ago

If it's saved as a string, it will be output as text with \n and not interpreted as an HTML tag. [\n < is not HTML, by the way]

Waldi2007
2 years ago

In HTML, you should use "<br />" instead of "\n"