ZF-3938: Set and retrieve document encoding in Zend_Dom_Query


It would be useful to be able to set and/or retrieve the encoding used to interpret the underlying document in Zend_Dom_Query. Some possible use cases:

// Assign encoding at construction
$queryObject = new Zend_Dom_Query($string, 'utf-8');

// Assign encoding through mutator

// Assign encoding in setDocument*() methods
$queryObject->setDocument($string, 'utf-8');
$queryObject->setDocumentHtml($string, 'utf-8');
// etc.

// Retrieve current encoding
echo $queryObject->getEncoding(); // utf-8


I have problems with encoding, after querying some html with Zend_Dom_Query Serbian chars (š.č,ć...) are messed, any idea how to fix this?

I have problems with decode too. When Zend_Dom_Query recive utf text with russian chars, He return not readable text. Any combinations with iconv did't have result. Check please your plugin.

Matthew, any update?

Added capabilities as described in the issue to trunk; will release with 1.11.0; please test.