Forum Moderators: coopster

Message Too Old, No Replies

Encode non-ASCII char for RSS/XML output

For example, “, ”...

         

iProgram

8:16 am on Mar 21, 2005 (gmt 0)

10+ Year Member



I need to generate XML feed of some articles and some of this articles contain non-ASCII characters. When open the output XML file IE will report error.

Here is the first line of my XML file:
<?xml version="1.0" encoding="utf-8"?>

The problem is I don't know which non-ASCII chars are in these articles so I'm looking for a function which can encode all these non-ASCII chars into &#123; For example the double quote needs to be encoded into &#147;(left quote) and &#148;(right quote).

coopster

12:31 pm on Apr 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



*bump*
You mean something like htmlentities() [php.net]?