0

I receive from the user text(non-html) and I store it in a database. I have in database text that have '\n' characters for end of the line.

- list one text\n
- list 2 text\n

In the browser code source this can be seen, but are nor reflected also in html.

How can I make it to be reflected in html ?

user3541631
  • 3,686
  • 8
  • 48
  • 115
  • i think you can just change \n with
    tag
    – HamzaNig Oct 29 '18 at 16:04
  • `\n` - is UNIX-style line ending for line break. Are you using a server-side language at all (HTML on its own can't fix this issue - someone correct me if I'm wrong :)) – treyBake Oct 29 '18 at 16:05
  • 2
    Possible duplicate of [Line break in html with \`\n\`](https://stackoverflow.com/questions/39325414/line-break-in-html-with-n) – Peter B Oct 29 '18 at 16:07
  • If its a database you must be getting it with some other language - what is it? As probably you can change it after fetching the data before sending to the html. Otherwise onload you can use JS/jQuery to go and find each `\n` and swap it for `
    `
    – D.V.D. Oct 29 '18 at 16:10
  • I use python as backend, I thought maybe are some special characters/encoding like non-braking space – user3541631 Oct 29 '18 at 16:12
  • in that case... pos duplicate of https://stackoverflow.com/questions/4369159/replace-n-with-br – treyBake Oct 29 '18 at 16:13
  • Does this answer your question? [What's the correct way to display multi line text?](https://stackoverflow.com/questions/49719774/whats-the-correct-way-to-display-multi-line-text) – Karl Knechtel Aug 06 '22 at 01:41

0 Answers0