News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zend Developer Zone:
PHP DOM XML extension encoding processing
September 02, 2009 @ 09:48:18

On the Zend Developer Zone today Alexander Veremyev shares some helpful hints he discovered about the DOM XML extension for PHP that could come in handy when working with different character encodings.

I recently worked with PHP's DOM XML extension while working on Zend Framework's Zend_Search_Lucene HTML highlighting capabilities, and uncovered some undocumented features and issues with the extension in regards to character encoding. The information contained in this article should also apply to other libxml-based DOM implementations, as PHP's DOM extension simply wraps that library.

There's five different tips he shares:

  • Internal document encoding is always UTF-8
  • Input data is always treated as UTF-8
  • Text nodes and CDATA are stored as UTF-8 without transformations
  • Document encoding does not affect loading behavior
  • Save/dumping operations and encoding

He describes each of the points and includes some sample code and XML to parse to help illustrate each.

0 comments voice your opinion now!
tutorial dom extension character encoding


blog comments powered by Disqus

Similar Posts

DevShed: Building a Data Validation System with the Prototype Pattern with PHP 5

PHP-Coding-Practices.com: How To Generate Monochromatic CSS Stylesheets Within Seconds Using PHP

Andreas Gohr's Blog: Understanding PHP code better with Xdebug

O'Reilly Broadcast: Getting Drupal and mod_security to Play Nicely Together on Red Hat 5.x Servers

PHPMaster.com: Data Structures for PHP Devs: Trees


Community Events





Don't see your event here?
Let us know!


configure release series api homestead application introduction list code community interview wordpress install developer language laravel library podcast threedevsandamaybe unittest

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework