|
Posted by Curtis on 12/08/05 01:01
ZeldorBlat <zeldorblat@gmail.com> wrote in message
news:1133915621.754884.28630@g47g2000cwa.googlegroups.com...
> >Is it safe to use these characters, or is there any
danger
> >the same characters will somehow show up unbidden in the
> >user input text and mess up our text segmenting and
> >reassembly?
>
> Sure it's safe to do that, and sure there's a danger that
they will
> show up in user-submitted data.
>
> Just make sure that you pick characters that don't have
some other
> meaning (like null or \n) but have an obvious equivalent
(which, for
> most of them, will be an empty string). Look at ASCII
values 1 - 31.
>
> Before you do your processing, just replace any characters
that you've
> reserved with nothing (or a space, or something else as
you see fit):
>
> $my_special_chars = array(chr(1), chr(2), chr(3));
> $input = str_replace($my_special_chars, '', $input);
> file://process $input
Thanks, ZB. Exactly what I needed.
I wasn't sure what to count on insofar as characters that
might show up in user transmitted text. We're taking care of
all the \r \n permutations by converting them all to \r
characters, breaking apart the paragraphs on those,
converting all the leftovers after processing to \n<br />,
and formatting the HTML code output using \n characters.
So far we've been using chr(1) and chr(2) for segment
skipping, but we'll be sure to filter them out of incoming
text as you advised.
--
Curtis
www.wethethinking.com
An online magazine/forum
devoted to philosophical
thought.
[Back to original message]
|