>>> suppressed 03/24/05 10:38AM >>> > Hi, > We were using the character limit thing on the filter tag, and were > getting frustrated that it treated html entites as > 1 characters, and > if there were html tags in the string, it didnt close the tags. > <snip example> > > Basically this can leave bad html code that will not validate. > > After a morning of programming, I have made this code correctly close > open html tags (ignores self closed tags) and treat html entites as one > character. This isn't a half bad idea, except that it leads to strings that can be quite a bit longer than the x characters implied in a [filter x]... tag. This patch makes [filter x] effectively useless for limiting the length of code that might need its size limited. > Examples: > [filter 20.]The sheep the sheep theyre gaining on me![/filter] = 'The > sheep the sheep …' This one would be fine if you replaced '20.' with '20' > [filter 20.]The sheep <strong>the sheep theyre gaining on > me</strong>![/filter] = 'The sheep <strong>the sheep </strong>…' This one, though, would lead to a string around 45 characters long. Kinda defeats the purpose of limiting the size to 20 characters. And a pathological example of my own.... [filter 10]<strong>T</strong><strong>h</strong><strong>e</strong> <strong>s</strong><strong>h</strong><strong>e</strong><strong>e</strong><strong>p</strong>[/filter] which--if your examples are right--won't chop anything at all, even though the content is nearly 15 times as long as i'd expect it to be. I would suggest that you separate the checks, so that /^(\d+)\.$/ and /^(\d+)$/ are checked separately. Unless there's a dot, the filter should act as it did before; that is, chop off any characters after the x'th, even if it involves breaking HTML tags. Otherwise, any code that relies on it to limit a field's real length might run into trouble. BTW....that sure is a lot of code. :) _______________________________________________ interchange-users mailing list suppressed http://www.icdevgroup.org/mailman/listinfo/interchange-users
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.