tags:

views:

50

answers:

1

Hi,

I got the following error,

An invalid character was found in text content. Error processing resource

when I dynamically created xml file using php.The encoding I used was utf-8.I changed it to ISO-8859-1.The error resolved.But the issue is I am having tamil,hindi content So it is displayed as

à®à®à¯à®°à®¾-à®à¯à®à¯à®à¯-

header('Content-Type: application/xml'); echo '<?xml version="1.0" encoding="UTF-8"?>'."\n"; ?> <urlset xmlns="http://www.google.com/schemas/sitemap/0.84"&gt; <?php $sql = "SELECT * FROM table "; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { ?>  <url>  <loc>http://example.com/&lt;?php echo $row[2]; ?></loc>  <lastmod><?php echo str_replace(' ', 'T', $row['dat']).substr(date("O"), 0, -2).':00'; ?></lastmod>  </url> <?php } ?></urlset>

How to solve this?

Regards Rekha http://hiox.org


adding code from comment below:

<?
    header('Content-Type: application/xml');
    echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"&gt;
<?php
     $sql = "SELECT * FROM table ";
     $result = mysql_query($sql) or die(mysql_error());
     while($row = mysql_fetch_assoc($result)) {
?>
    <url>
        <loc>http://example.com/&lt;?php echo $row[2]; ?></loc>
        <lastmod><?php echo str_replace(' ', 'T', $row['dat']).substr(date("O"), 0, -2).':00'; ?></lastmod>
    </url>
<?php } ?>
</urlset>
+1  A: 

ISO-8859-1 does not have the coverage over hindi and tamil alphabets

Chathuranga Chandrasekara
+1 That is the issue at hand.
Pekka
Yes.But the error disappears when I used ISO-8859-1 but tamil fonts are not displaying correctly.
Rekha