|
Posted by Janwillem Borleffs on 04/22/06 00:00
gene.ellis@gmail.com wrote:
>
[Removed php.general because it's unknown to my news server]
> The system tends to chock on
> really weird formatting that comes out of Microsoft Word when people
> copy+paste words/phrases that Microsoft has underlined as being
> misspelled. Anyone know of a good error checking mechanism? Thank you
> so much!
>
Misspelling can't be the reason of problems, unless the value contains
preserved characters (<>& etc.).
To catch these characters, you can apply htmlentities() to transform them
into valid entities; to get rid of control characters, you could write a
simple routine like the following to filter the source text:
function filter($c) {
return ord($c[0]) <= 126 ? $c[0] : '';
}
$filtered = preg_replace_callback('/./s', 'filter', $unfiltered);
Note that this is just an example and might not be suitable for your needs.
JW
Navigation:
[Reply to this message]
|