[GH-ISSUE #44] Double encoding render error #20

Closed
opened 2026-02-27 23:20:03 +03:00 by kerem · 5 comments
Owner

Originally created by @freekmurze on GitHub (Sep 28, 2018).
Original GitHub issue: https://github.com/spatie/dnsrecords.io/issues/44

See: https://twitter.com/bartvanraaij/status/1045607240248565761

This should be fixed.

Originally created by @freekmurze on GitHub (Sep 28, 2018). Original GitHub issue: https://github.com/spatie/dnsrecords.io/issues/44 See: https://twitter.com/bartvanraaij/status/1045607240248565761 This should be fixed.
kerem 2026-02-27 23:20:03 +03:00
Author
Owner

@jryd commented on GitHub (Sep 28, 2018):

I'll take a look at this now.

<!-- gh-comment-id:425393790 --> @jryd commented on GitHub (Sep 28, 2018): I'll take a look at this now.
Author
Owner

@bartvanraaij commented on GitHub (Sep 28, 2018):

@jryd you beat me to it by 16 seconds, lol!
Slight difference in implementation though.
My PR just removes the htmlentities() altogether because I assumed the htmlspecialchars-encoding of Blade would be sufficient. Is there any reason to to think otherwise?

<!-- gh-comment-id:425399920 --> @bartvanraaij commented on GitHub (Sep 28, 2018): @jryd you beat me to it by 16 seconds, lol! Slight difference in implementation though. My PR just removes the `htmlentities()` altogether because I assumed the htmlspecialchars-encoding of Blade would be sufficient. Is there any reason to to think otherwise?
Author
Owner

@jryd commented on GitHub (Sep 28, 2018):

@bartvanraaij unless I am mistaken, this won't fix the issue? htmlspecialchars still performs translation on quotes?

I gave this a whirl in tinker to verify:
image

<!-- gh-comment-id:425402324 --> @jryd commented on GitHub (Sep 28, 2018): @bartvanraaij unless I am mistaken, this won't fix the issue? [htmlspecialchars](http://php.net/manual/en/function.htmlspecialchars.php) still performs translation on quotes? I gave this a whirl in tinker to verify: ![image](https://user-images.githubusercontent.com/13251203/46204995-86c3f280-c362-11e8-8e50-c67f87fd0eac.png)
Author
Owner

@bartvanraaij commented on GitHub (Sep 28, 2018):

@jryd

A single round of encoding is completely fine, because the browser will display &quot; as ".
The problem was that htmlentities() transformed a " into &quot; and after that htmlspecialchars() (inside Blade) transformed that into &amp;quot; (see screenshot in my tweet).

See screenshot with my patch applied:
screenshot 2018-09-28 at 13 33 59

<!-- gh-comment-id:425407650 --> @bartvanraaij commented on GitHub (Sep 28, 2018): @jryd A single round of encoding is completely fine, because the browser will display `&quot;` as `"`. The problem was that `htmlentities()` transformed a `"` into `&quot;` and after that `htmlspecialchars()` (inside Blade) transformed that into `&amp;quot;` (see screenshot in my tweet). See screenshot with my patch applied: ![screenshot 2018-09-28 at 13 33 59](https://user-images.githubusercontent.com/21202865/46206080-2bbedb00-c323-11e8-8454-26f1bc7b4fab.png)
Author
Owner

@jryd commented on GitHub (Sep 28, 2018):

Ahh yes, I stand corrected. Unless there’s a need to remove any html entities, then I am inclined to agree that your implementation is better.

<!-- gh-comment-id:425408490 --> @jryd commented on GitHub (Sep 28, 2018): Ahh yes, I stand corrected. Unless there’s a need to remove any html entities, then I am inclined to agree that your implementation is better.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dnsrecords.io#20
No description provided.