[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
ClanKiller.com :: View topic - c# version of nl2br that is "html safe"
ClanKiller.com
https://forums.clankiller.com/

c# version of nl2br that is "html safe"
https://forums.clankiller.com/viewtopic.php?f=24&t=2691
Page 1 of 1

Author:  Satis [ Mon Dec 24, 2007 8:06 am ]
Post subject:  c# version of nl2br that is "html safe"


Author:  Satis [ Fri Dec 28, 2007 7:37 am ]
Post subject: 


Author:  RB [ Thu Jan 03, 2008 7:13 am ]
Post subject: 


Author:  Satis [ Thu Jan 03, 2008 6:48 pm ]
Post subject: 


Author:  RB [ Sat Jan 05, 2008 1:44 am ]
Post subject: 


Author:  Satis [ Sat Jan 05, 2008 10:55 am ]
Post subject: 


Author:  RB [ Sat Jan 05, 2008 1:47 pm ]
Post subject: 


Author:  RB [ Sat Jan 05, 2008 2:34 pm ]
Post subject: 


Author:  Satis [ Sat Jan 05, 2008 5:50 pm ]
Post subject: 


Author:  RB [ Sat Jan 05, 2008 6:06 pm ]
Post subject: 

Look for '<'s in the text. If a '<' is followed by a tag name, then it is (most probably) an opening tag. If '<' is followed by '/' and a tag name, then it is (most probably) an closing tag.

The C++ thing isn't perfect from the point of leaks and speed too. But I thought it would not serve the purpose (showing some basic structure) if it were in full size and shine. So, don't spend much time on it.

Now, sigh, actually I didn't want you to tell me what your code is doing (I could see that barely), but to define the problem. Now, sorry for the ignorance, but I had very few meetups with C# and you may be assuming what someone else (say who knows less or same as me) don't know. So, let me try to define the problem:

You got HTML code, where you should replace LFs with BRs. Yet, some sort of problem occurs when you put BRs on place of each LF, and that is why you don't print it when LF is nested between some tags.

If my guess of what you are trying to make is right, this might be not so luckily approach. Why don't you define as well tags where LF should be replaced with BR in the first place? For example, in <table><tr><td> ... </td></tr></table> you may have text. This text can be formatted with <br />s. So (abstract point) ... every time you want to solve some problem, define it. This topic may need a split so that useful information be separated from talk about it.

Author:  Satis [ Sun Jan 06, 2008 9:53 am ]
Post subject: 

Ah, ok. Yes, the point is that line feeds in some html structures (style, table and lists) don't get converted to <br>. That way if you have a prettily-formatted table in html and you run it through the method to convert the LF to <br> you don't end up with 30 line feeds in front due to all the LFs inside the html code.

The reason I need it is because the data input may be by people that don't understand html. Input it via a textarea that then gets saved to a database. When redisplaying the content in html form I don't want it messing up the LFs. How can someone that doesn't know html add html that'll screw up the formatting? Microsoft! They're practically html ignorant but know enough about MS apps to 'save for web' and get html markup to create tables, without actually knowing html.

Hope that helps. :)

Author:  RB [ Sun Jan 06, 2008 12:15 pm ]
Post subject: 

Ok, you know best what an user can put into textarea you are expecting input from. The task is pretty abstract without that (and thanks, I don't need to know it), but I think I can cast a suggestion: maybe it is easier to define on which areas of the input conversion should be done, no matter if they are in a table or even list (you can use <br>s in a list).

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/