# Notifications menu shows raw backslash escapes in titles

**URL:** https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028
**Category:** Bug
**Created:** [27 februari 2017 om 17:07 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028 "2017-02-27T17:07:49Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![LeoDavidson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leodavidson/32/119574_2.png) [@LeoDavidson](https://meta.discourse.org/u/LeoDavidson)
#### Post date: [27 februari 2017 om 17:07 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/1 "2017-02-27T17:07:49Z")

</div>

This is quite minor, at least in the situation I saw it in.

* * *

- The notifications menu looks like it shows raw topic titles, without applying the backslash escaping rules. Compare left and right red boxes:

* * *

- Here’s what the raw thread title looks like:

* * *

- And how the title is rendered when viewing the topic itself:

* * *

All look correct to me except for the notification menu.

(We also surely have proof that time travel will never exist, as nobody has gone back in time and stopped MS-DOS / Windows from using a common escape character all over file paths and leaking into conversations about file paths. 😃 )

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [10 maart 2017 om 21:04 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/3 "2017-03-10T21:04:51Z")

</div>

I don’t think this is worth fixing.

There is no need to escape \ in titles, this is subtle bug in our title prettier.

Just make your title `..folder Using "\"; Says...` no need to escape stuff.

---

<div class="post-metadata">

### Author: ![LeoDavidson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leodavidson/32/119574_2.png) [@LeoDavidson](https://meta.discourse.org/u/LeoDavidson)
#### Post date: [10 maart 2017 om 21:36 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/4 "2017-03-10T21:36:48Z")

</div>

FWIW, there are some cases where you do need to escape baskslashes in titles.

One example is a title about UNC paths in Windows:

* * *

`Problem going to \\server\share`

becomes:

Problem going to \server\share

unless you double up the first pair of backslashes:

`Problem going to \\\\server\share`

* * *

Our forum is about a file manager, so this example isn’t entirely contrived. That said, it is still rare for it to matter, and the problem is still small and cosmetic, so it may still not be worth fixing. We can certainly live with it.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [10 maart 2017 om 21:38 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/5 "2017-03-10T21:38:58Z")

</div>

I think that is a bug then … our pretifier has to stop this backslash escaping.

It is completely non-obvious that you should need to escape in the title.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [10 maart 2017 om 21:43 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/6 "2017-03-10T21:43:43Z")

</div>

I see… was reading through the code, will leave it for @codinghorror to decide.

The reason this happens is due to:

> <https://github.com/discourse/discourse/blob/5dbd6a304bed5400be481d71061d3e3ebb4d6785/lib/html_prettify.rb#L179-L194>

Should I remove this magic?

Or maybe our topic titles should be passed through the prettfier prior to being sent as notifications. Not sure.

---

<div class="post-metadata">

### Author: ![LeoDavidson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leodavidson/32/119574_2.png) [@LeoDavidson](https://meta.discourse.org/u/LeoDavidson)
#### Post date: [10 maart 2017 om 21:55 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/7 "2017-03-10T21:55:04Z")

</div>

If the escaping is kept in titles, one thing that is a little odd is that the rules aren’t the same as in message bodies.

For example, C:\* requires you double the backslash in a message body, but not in a title.

(I guess it makes sense in a way: Bold and italic markdown don’t apply to titles, \* has no special meaning at the end of words in titles, so it doesn’t need escaping. OTOH, it’s easier to remember either one set of rules, or that escaping isn’t needed at all for titles. Still, it’s minor in the grand scheme of things so whatever you choose to do, if anything, is fine. Always a risk that changing something breaks something else!)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [10 maart 2017 om 22:10 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/8 "2017-03-10T22:10:21Z")

</div>

That only applies to titles? Why is that even there?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [10 maart 2017 om 22:11 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/9 "2017-03-10T22:11:38Z")

</div>

That code only apply to title prettify, we lifted it from the original implementation. Happy to remove it if you are comfortable with there being no easy way to specify `"` in a title (as opposed to the pretiffied version)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [10 maart 2017 om 22:15 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/10 "2017-03-10T22:15:01Z")

</div>

Yeah I suggest removing it then

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [10 maart 2017 om 22:16 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/11 "2017-03-10T22:16:33Z")

</div>

There is still the edge case that quotes are not all “fancy” in notifications, we should probably make it consistent some day.

But, agree, that fancy escaping is just confusing for most people.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [13 maart 2017 om 14:02 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/13 "2017-03-13T14:02:48Z")

</div>

This specific issue is fixed by:

[https://github.com/discourse/discourse/commit/82ca0e368e8758b463c0c589f649f9bb73fc2d79](https://github.com/discourse/discourse/commit/82ca0e368e8758b463c0c589f649f9bb73fc2d79)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [13 maart 2017 om 14:02 UTC](https://meta.discourse.org/t/notifications-menu-shows-raw-backslash-escapes-in-titles/58028/14 "2017-03-13T14:02:52Z")

</div>


