You are here: PHP 5 DOM, XPath, UTF-8, and Form Input « PHP « IT news, forums, messages
PHP 5 DOM, XPath, UTF-8, and Form Input

Posted by C Drozdowski on 03/19/05 17:42

I have been doing some testing and need confirmation that the following
is correct.

You have a DOMDocument that potentially contains UTF-8 encoded data (it
might not however).

You want to search it via DOMXpath->query() using a value that comes
from a $_POST value.

If the page that posts the data via a form to the search script IS NOT
encoded in UTF-8, then the value must be converted to UTF-8 before it
is used in the query expression.

Else, if the posting page IS UTF-8 encoded, then the $_POST data does
not need to be converted before being used in the expression.

Is this correct?

Also, if the $_POST data comes from a UTF-8 encoded page, and it needs
to be sanitized before use, will the basic PHP string functions work on
the data (e.g. htmlentities, stripslashes, trim, preg_replace, etc)?

If not what do I have to do?

 

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

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