My DB has some text which is probably copied and pasted from word document contains some curly quotes and curly apostrophes. PHP code is generating XML data/document with this text as one of its XML element.
This is the error I'm getting when I try to display the XMl doc
This page contains the following errors:
error on line 40 at column 1: Encoding error
Below is a rendering of the page up to the first error.
I've tried as mentioned in the post here, but it isn't working for me. Also tried
$output = iconv('UTF-8', 'ASCII//TRANSLIT', $input);
as mentioned here. This one displays the text till curly quotes or apostrophe appears. Do I need to mention any different character output format here?
Is there any function available in PHP to handle these type of special characters when generating XML document. I am using <?xml version="1.0" encoding="utf-8"?>
character encoding for XML documnet
Here is some of my code
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="utf-8"?>';
$item = mysql_fetch_object($result);
<listitems>
<item>
<name><?=htmlspecialchars(stripslashes($item->name))?></name>
<details><?=htmlspecialchars(stripslashes($item->details))?></details>
.
.
.
.
</item>
</listitems>