\n in User Account Name?
Hello! If you have \n somewhere in the user account name, will it be displayed in two lines? Because HTML should interpret it that way, right?
Hello! If you have \n somewhere in the user account name, will it be displayed in two lines? Because HTML should interpret it that way, right?
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.
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.
This is usually escaped when creating the username.
Not to mention that this is not a line break in HTML.
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".
Uh, yes, that's right!
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]
In HTML, you should use "<br />" instead of "\n"