Skip to content
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

Encoding problems and no_entities #173

Open
markseuffert opened this issue Aug 25, 2014 · 4 comments
Open

Encoding problems and no_entities #173

markseuffert opened this issue Aug 25, 2014 · 4 comments

Comments

@markseuffert
Copy link

Hi,

I was testing how to prevent HTML code in generated output, together with @wunderfeyd. Looks like there's a double encoding when using no_markup = true and no_entities = true.

Input: **<script>**
Output: <p><strong>&amp;lt;script></strong></p>
Input: [text<text](link)
Output: <p><a href="link">text&amp;lt;text</a></p>

It doesn't happen when using no_markup = true only.

@jdufresne
Copy link
Contributor

I recently hit this same issue: Using the test script:

$my_text = '**foo & bar**';
$parser = new \Michelf\Markdown();
$parser->no_markup = true;
$parser->no_entities = true;
$my_html = $parser->transform($my_text);
echo $my_html;

This outputs:

<p><strong>foo &amp;amp; bar</strong></p>

However I would expect:

<p><strong>foo &amp; bar</strong></p>

@michelf
Copy link
Owner

michelf commented Dec 2, 2014

Indeed, that shouldn't happen. I'll get down to it eventually, but I'd also be happy to accept a pull request.

Maintaining those two modes is somewhat cumbersome given there's no way to test the non-defaut mode in MDTest.

@markseuffert
Copy link
Author

We don't use no_entities = true anymore, no encoding problems without it.

@michelf
Copy link
Owner

michelf commented Oct 21, 2015

I guess it's fixed in Yellow, but this issue about double-encoding is still present in PHP Markdown when no_entities = true, and is still worth fixing. So I'll keep it open.

@michelf michelf reopened this Oct 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants