Comments (4)
Erm, can you give some code example? I just don't get what you mean?
from feedwriter.
Oups yes sorry my initial message doesn't contains much infos...
Feed item elements are built using htmlspecialchars():
- https://github.com/mibe/FeedWriter/blob/master/Feed.php#L730
- https://github.com/mibe/FeedWriter/blob/master/Feed.php#L749
The choice of using htmlspecialchars() could be leave to developer...
For example, this is an issue with links containing query string parts; e.g.:
$item->setLink('http://example.com/?dont=borgat&that=join&my=friend');
// The above item element content will output a non equivalent link: http://example.com/?dont=borgat&that=join&my=friend
To resolve this I've remove those htmlspecialchars() usages: trepmag@9589f10
from feedwriter.
Thank you for your explanation, I get it now.
The problem with the ampersand character is that this is a special character in the XML specification. The spec says:
The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form […]. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings "&" and "<" respectively.
So without htmlspecialchars()
the feed would not validate properly. See the result of W3C's feed validation service here (I've encoded the ampersand in the title, otherwise the service would have stopped there).
But that encoded ampersand shouldn't actually be a problem. The client which parses the XML should turn that back into a real ampersand character. Here's a screenshot of Firefox displaying the URL with encoded ampersands.
But there is a workaround to have valid, unencoded ampersands in the link
element: Wrap the link in a CDATA section. To do this call the addCDATAEncoding()
method of the Feed
class:
$feed->addCDATAEncoding(array('link'));
I hope that helps (and sorry I took so long to reply)
from feedwriter.
Hello Mibe, this should works perfectly!
Thanks,
Cedric
from feedwriter.
Related Issues (20)
- Publish on Packagist HOT 2
- Cannot assign attributes to channel elements HOT 3
- Can We Have A Tagged Release Please? HOT 1
- Set image to item HOT 1
- The 'generator' element in ATOM feeds is missing the URI HOT 1
- Use PHP's XML functions for generating the XML.
- Better error handling HOT 1
- Atom title text could support XHTML and HTML elements
- can't add images to RSS HOT 2
- Filter for removing invalid XML chars returns empty string on regex error HOT 1
- Example throws Internal Error 500 on use \FeedWriter\RSS2; HOT 5
- Use tag instead of urn URI scheme for IDs HOT 3
- 404 error in documentation HOT 1
- tagContent attributes HOT 1
- Add support for JSON Feed
- Add rel="self" HOT 2
- Namespacing preferences? HOT 5
- Refactoring Suggestion HOT 1
- Add more xmlns HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feedwriter.