# \`&rsquo;\` nos títulos dos tópicos na página de erro

**URL:** https://meta.discourse.org/t/rsquo-in-topic-titles-on-oops-page/406309
**Category:** Bug
**Tags:** fixed
**Created:** [Junho 28, 2026, 1:47pm UTC](https://meta.discourse.org/t/rsquo-in-topic-titles-on-oops-page/406309 "2026-06-28T13:47:12Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [Junho 29, 2026, 2:17pm UTC](https://meta.discourse.org/t/rsquo-in-topic-titles-on-oops-page/406309/5 "2026-06-29T14:17:45Z")

</div>

O que você acha dessa aqui, @sam?

> <https://github.com/discourse/discourse/pull/41261>
>
> Previously, content that was already HTML-escaped — topic \`fancy\_title\`s on the …404/oops pages, GitHub onebox labels, and topic/group/category \`\<meta\>\` descriptions — got escaped a second time, so readers (and crawlers) saw literal entities like \`&rsquo;\` and \`&amp;\` instead of \`'\` and \`&\`.
> 
> This change escapes every value exactly once, by converting it to plain text before it reaches the renderer instead of flagging anything \`html\_safe\`:
> 
> \- \`Emoji.codes\_to\_img\` escapes its text segments with \`html\_escape\_once\` so the already-escaped \`fancy\_title\` and sanitized GitHub labels aren't escaped again. All of its callers render into element content, and the attribute escaping inside \`emoji\_img\_tag\` is untouched.
> \- the new \`ExcerptParser.to\_plain\_text\` converts a stored excerpt (escaped text, the \`&hellip;\` truncation marker, and the hashtag placeholder markup the parser keeps) back to plain text, exposed as \`Topic#plain\_text\_excerpt\`. It's a tag-strip plus a memoized \`htmlentities\` decode — pure Ruby, a few microseconds per excerpt, no Nokogiri in the hot path.
> \- \`Category#plain\_text\_description\` caches the pre-escape plain text that \`description\_text\` previously discarded, and the category meta descriptions use it directly. This also fixes the double-escaped \`og:description\`/\`twitter:description\` on category pages, where \`gsub\_emoji\_to\_unicode\` silently drops the \`html\_safe\` flag of \`description\_text\`.
> \- the new \`Group#bio\_summary\` mirrors \`UserProfile#bio\_summary\`: a plain-text excerpt of the bio with links and images stripped and hashtags rendered as plain \`#slug\`.
> 
> Marking the stored values \`html\_safe\` would have worked for the column data — every writer of \`topics.excerpt\` escapes — but \`topic.excerpt\` can be swapped in-memory with a localized excerpt that isn't guaranteed to be escaped, so treating everything as unsafe plain text is both simpler and safer.

---

_[View the full topic](https://meta.discourse.org/t/rsquo-in-topic-titles-on-oops-page/406309)._
