HTMLencode HTMLdecode
Posted
by elenor
on Stack Overflow
See other posts from Stack Overflow
or by elenor
Published on 2010-04-16T01:38:29Z
Indexed on
2010/04/16
1:43 UTC
Read the original article
Hit count: 469
htmlencode
I have a text area and I want to store the text entered by user in database with html formatting like paragraph break, numbered list. I am using HTMLencode and HTMLdecode for this.
Sample of my code is like this: string str1 = Server.HtmlEncode(TextBox1.Text); Response.Write(Server.HtmlDecode(str1));
If user entered text with 2 paragraphs, str1 shows characters \r\n\r\n between paragraphs. but when it writes it to screen, just append 2nd paragraph with 1st. While I'm decoding it, why doesn't it print 2 paragraphs?
© Stack Overflow or respective owner