[My EDITED New Question]
I am taking text input in HTML form as . Suppose the user entered the following text:
Raw text include characters only, not formatting like bold, italics or underline. Tabs, punctuation marks and newline are characters, so a simple varchar will do if all you really need is this.
But you have to decide on a formatting protocol if you want bold, italics and underlined text: HTML, wiki syntax, RTF, etc. If this format is textual, a varchar will do. If it's binary, you'll need a blob.
If you have newlines in your text and it's displayed on a single line, it's probably because you output it in a HTML page, where sequences of space characters (tabs, spaces, newlines, etc.) are converted to a simple space. Use a <pre>your HTML-escaped text here</pre>
section, and it will display the newlines, tabs and multiple spaces correctly.
Spaces and punctuation are preserved.
If you're not seeing them, then you're probably outputting the text in an HTML document and forgetting to mark it up as HTML: remember, web browsers ignore newlines and consecutive spaces in plaintext.
As for formatting like bold, you need to come up with some way of marking-up your text to store the formatting information. You might consider HTML or Markdown.
I think you can store with utf_encode()
. and get it with utf_decode()
. You can see the n12br
function of PHP.
-- EDIT --
I encrypt using base64_encode()
and to get I use base64_decode()
.
Tabs, spaces and special characters are preserved.