What are the potential pitfalls of using different character encoding (UTF-8 vs ISO-8859-1) in PHP when importing XML files?
Using different character encodings (such as UTF-8 and ISO-8859-1) when importing XML files in PHP can lead to encoding issues and garbled text. To solve this problem, you should ensure that the XML file and your PHP script use the same character encoding. You can convert the encoding of the XML file to match the desired encoding in your PHP script using functions like `mb_convert_encoding()`.
$xmlString = file_get_contents('example.xml');
$xmlString = mb_convert_encoding($xmlString, 'UTF-8', 'ISO-8859-1');
$xml = simplexml_load_string($xmlString);
// Continue processing the XML file