php - problem with rss feed and cdata -
I have a problem with an RSS feed
When I & lt; Title & gt; This is a title & lt; / Title & gt;
The title appears well in the feed
> But when I get the $$ title = "this is a sesame";
& lt; Title & gt; & Lt ;! [CDATA ['$ title']] & gt; & Lt; / Title & gt; The title does not appear at all.
It still does not work. I dynamically generate my RSS feed and it looks like this:
and in a loop:
$ s Array (htmlentities ($ line ["title"]) = Str_replace (array ("[[title]]", "[[link]]", "[[description]]", "[[date]]") , $ Url, $ description, $ date), $ item_template); The problem is especially when there is a Euro sign in the title, it appears in my RSS verifier:
a More detailed information:
Well, I was mosquito with this for the past few days and I can not find any solution I'll start a reward Here's more information:
- The information given in the feed is stored in the Latin 1 database (which is I administered)
- The problem arises when the Euro mark is anything in the database like € or
and euro; - Occasionally looks like a euro sign as if weird extremists or like \ x80
- I try to resolve
- forward : Sometimes when the Euro mark can not be parsed (either title) or description) is shown blank. So if you look in the source when showing a feed in a browser, you should see the
& lt; Title & gt; & Lt; / Title & gt;
If there is more information please ask.
The problem is your output code; Change
echo & lt; Title & gt; & Lt ;! [CDATA [$ title]] & gt; & Lt; / Title & gt; '; to
echo & lt; Title & gt; & Lt ;! [CDATA ['. $ Heading ']] & Gt; & Lt; / Title> '; As a side note, please keep the following in mind: Do not answer your question with follow-up, but edit original one. Do not use regexps for any good reason. Do not guess Instead, you should do all that you should do: Wrap and do the heading, like:
echo & lt; Title & gt; '. Htmlentities ($ heading, ENT_NOQUOTES, [encoding]). '& Lt; / Title> ';
Replace [encoding] with character encoding you are using. Mostly, this is 'UTF-8', it is necessary because php (& lt; 6) uses ISO-8859-1 by default and there is no way to express that the echo sign in that encoding For more information, please see it.
I also suggest you. Start with the second chapter.
Comments
Post a Comment