I have an xml file which i am trying to display through a php script, it displays everything fine until i change the contents of the xml file to Arabic letters at which the file does not load.

here is the xml file:

<?xml version="1.0"?> 
      <listName>name of the student</listName>


and here is the php script:

  $student = "test.xml" ; 
  $xml = @simplexml_load_file($student) or die ("no file loaded") ; 
  $studentlist = $xml->listName ;
  echo "<h1>List: " . $studentlist . "</h1>";
  foreach ($xml->studentdetalis as $studentdetalis) {
  echo "<h2>Food group name is " . $studentdetalis->studentnumber . "</h2>" ;

  foreach ($studentdetalis->subjects as $subjects) {
      echo "<br /> physics: " . $subjects->physics ;
	  echo "<br /> chemistry: " . $subjects->chemistry ;
      echo "<br />" ;
  echo "<br />" ;

when I try, for example, to change the word between listname tags to Arabic letters i get the error no file loaded.

What am I doing wrong?

8 Years
Discussion Span
Last Post by khr2003

thanks for the link it was helpful. However I face the issue that my website is encoded in windows-1256 (Arabic) while the xml file is encoded in utf-8 (I can not encode the file in Arabic even if I add the encoding tag to it). The problem is when I view my website through the browser I get unknown characters for the xml content, while my website looks fine.

when I change the encoding of the website through the browser the content of the xml file look fine while my website does not.

is there a way to get around this issue?

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.