You are here: Re: Using PHP to screen out bad characters before writing XML « All PHP « IT news, forums, messages
Re: Using PHP to screen out bad characters before writing XML

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация