Simplexml_load_file in php does not recognize UTF-16 characters. I am getting

  • Thread starter Thread starter Vikram V
  • Start date Start date
V

Vikram V

Guest
garbled text. How do I resolve? I used an excel macro to generate an xml file containing chinese characters. This xml file is encoded in UTF-16 while saving. It also contains the line " <?xml version="1.0" encoding="UTF-16" standalone="yes" ?> " as the first line to indicate the mode the file is to be read in. While using simplexml_load_file in php to read this file, I get garbled text when I expect to see Chinese.


The code that I used to read this file is :

<?php
$languagexmlfile = 'cn_iqststrings.xml;;
if (file_exists ($languagexmlfile))
{
$xml = simplexml_load_file($languagexmlfile);
}
else
{
exit('Cannot open file ');
}
?>

This works when the content of the xml file is ascii characters, but it doesnt when i try to display chinese or Hindi characters.

Any help??
 
Back
Top