When working with documents containing language specific-data or when working with internatinalization and XML, you must deal with encoding properly.

Example, if you are from France and use French character set, you may get an error like this if you do not use proper encoding:

"Input is not proper UTF-8, ..."

if you use the libxml2.

The following declaration at the start of the document may fix the error:

<?xml version="1.0" encoding="ISO-8859-1"?>

There is also another aspect when usning libxml2, internal storage of an XML document. Regardless of the encoding specified for a document, the encoding is stored internally within libxml2 in UTF-8 format. Knowing this may save you hours of boring work, trying to fix an error.

Fortunately there are two extensions, iconv or mbstring that you should use when performing encoding conversion.