0

I'm trying to insert string(varchar) to my postgres database, which include new line tag, understandable to browser (I have to display this string in my web app).
I've tried using Escape Sequences like E'First Line\nSecond line', but it doesn't worked.
I've tried too using functions like split_part().

How can I achive effect from this:
'1. Lorem ipsum dolor sit amet 2. Lorem ipsum dolor sit amet 3.Lorem ipsum dolor sit amet'

To this:
'1. Lorem ipsum dolor sit amet
2. Lorem ipsum dolor sit amet
3. Lorem ipsum dolor sit amet'

I'am using PostgreSQL 9.6.
Any ideas?

1 Answer 1

1

This is an html/css question that has nothing to do with database, and that contains lots of answers such as this one.

The most simplest form would be to save <br />, the break tag, instead of \n

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for Your replay! I didn't mention, but of course I tried <br /> tags. I tried <br /> once again and I tried methods from Your link (like put string to <p><span> or <div><p> tags). But it doesn't work as well. Browser displaying tags like regular text.
To be clear. I insert this string into database. After that I load this string from database to List and then display List in column in my web app table.
You're right @JGH.<br/> tags are fine. In my outputText tag missing escape="false" attribute. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.