PHP 5 DOM, XPath, UTF-8, and Form Input

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux