-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly escape special characters in XML #77
Conversation
When using CDATA, it is unnecessary to escape html characters; however, one thing that must be escaped is the CEnd tag.
Hello? |
Sorry for the long wait, this PR seems to have slipped through the net. |
No problem, it can happen. I will take a look at the changes you requested soon! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpicks
It's no problem! |
Dear contributor, because this pull request seems to be inactive for quite some time now, I've automatically closed it. If you feel this pull request deserves some attention from my human colleagues feel free to reopen it. |
<![CDATA[]]>
sections do not need to have HTML escaped. Doing so causes strange output.For example, if the title of a Feed Item is "I like PB&J", then it would be output as "I like PB&J", which is subsequently what would be shown to the user.
However, what does need to be escaped is the CEnd tag:
]]>
. I made a helper function which escapes that so that no user input can cause any harm.I included a test to verify that the output is correct. I wasn't sure the exact way I should go about adding the test, so I created a new
SpecialDummyItem
class which has a title with strange characters.P.S. I also removed a space in the
<author>
tag... I couldn't help it.