# Using backslash to escape has buggies . .

**URL:** <https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748>\
**Category:** Site Feedback\
**Created:** [October 24, 2020, 7:24am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748 "2020-10-24T07:24:06Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 24, 2020, 7:24am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/1 "2020-10-24T07:24:06Z")

</div>

Since we seem to have @codinghorror’s attention today, here is a bug I’ve seen often:

Using the backslash character to, e.g. prevent © from appearing as © doesn’t work consistently. You can see that in the immediately previous sentence – there IS a backslash before the left parenthesis in the first © and this one too. In my experiments with this, it works thoroughly inconsistently, as far as I can tell. Putting backslash before both parentheses as in © sometimes fixes it, but not always. The only rule I can see is that having © more than once in one paragraph seems to affect how any other instances of © or ® or any of the others appear in the same paragraph.

I suspect this happens because the JS code doesn’t parse a paragraph of text in character-by-character left-to-right order, but instead probably does some kind of pattern-matching on the entire text at once.

(No, Discourse, my topic is not similar to “Are there any Roman amphitheatres that have seen constant use?”)

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/codinghorror/32/4242_2.png) [@codinghorror](https://boards.straightdope.com/u/codinghorror)\
**Post date:** [October 24, 2020, 10:09pm UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/2 "2020-10-24T22:09:52Z")

</div>

OK cool, let’s see.

`(c)` makes ©  
`(r)` makes ®  
`(tm)` makes ™

`\(c\)` makes (c)  
`\(r\)` makes (r)  
`\(tm\)` makes (tm)

But this is all single-line stuff as you noted, and also **you must escape both of them with the backslash, escaping only one is a recipe for… badness.**

I kinda wish -\> turned into → by itself as well… I need to add that to our to-do list.

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 25, 2020, 3:31am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/3 "2020-10-25T03:31:55Z")

</div>

> [@codinghorror](#):
>
> But this is all single-line stuff as you noted, and also **you must escape both of them with the backslash, escaping only one is a recipe for… badness.**

In the example paragraph I wrote above, there were examples of (c) with back-slash before both parentheses and it still appeared as (c). Here is one: (c). How about backslash only before the second parenthesis, like this: (c)? In other attempts I’ve made to investigate this, I couldn’t get consistent results, at least not according to any straightforward rule that I could see.

The case of (c) in particular comes up a lot when people try to make a list of items  
(a) like this one and  
(b) like this one too and  
(c) We still miss you Opal and  
(d) also like this one,

and it’s really tricky (if possible at all) to make the third item appear correctly.

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 25, 2020, 3:37am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/4 "2020-10-25T03:37:47Z")

</div>

But now compare the following to the above:

The case of © in particular comes up a lot when people try to make a list of items  
(a) like this one and  
(b) like this one too and

(c) We still miss you Opal and  
(d) also like this one,

See what’s different here?

---

<div class="post-metadata">

**Author:** ![Joey\_P](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@Joey\_P](https://boards.straightdope.com/u/Joey_P)\
**Post date:** [October 25, 2020, 3:59am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/5 "2020-10-25T03:59:23Z")

</div>

I mentioned it in another thread, but this seems like a good time to suggest it again. IMHO, there should be some special character or sequence of characters, that, when typed, will trigger the software to parse whatever immediately follows it as code or a special character or whatever. It should not be the case that a special character or sequence of characters is used similarly to noparse tags.

To me, the way it currently is, would be like if MS Word would automatically underline any word that started with the letter u, unless I explicitly told it not to. So if I wanted to write the word underline, I’d have to write \underline, so I don’t get nderline instead.

In other words, the default should be that what I type is what appears in my post.

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 25, 2020, 4:05am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/6 "2020-10-25T04:05:02Z")

</div>

What Joey\_P says would really have been the better way, but it’s way too late for that now.

Discourse actually implements a hodge-podge of subsets of three different markup styles: vBcode, Markdown, and bare-naked HTML. (I still use vBcode because I know it the best.)

With a massive base of existing posts (and that’s on SDMB alone, let alone on all the other Discourse boards), I can’t imagine how that can be changed now.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/codinghorror/32/4242_2.png) [@codinghorror](https://boards.straightdope.com/u/codinghorror)\
**Post date:** [October 25, 2020, 4:59am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/7 "2020-10-25T04:59:15Z")

</div>

Hmm, let me see

(a) one  
(b) two  
(c) three  
(d) four

What’s so difficult about this? I’m not really following:

```auto
(a) one
(b) two
\(c\) three
(d) four

```

Or in the same sentence? (a) one (b) two (c) three (d) four

aka

`Or in the same sentence? (a) one (b) two \(c\) three (d) four`

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 25, 2020, 5:05am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/8 "2020-10-25T05:05:05Z")

</div>

> [@codinghorror](#):
>
> Hmm, let me see
> 
> (a) one  
> (b) two  
> (c) three  
> (d) four
> 
> What’s so difficult about this? I’m not really following:

But compare with post #3 above. See the problem there? Here it is again, abbreviated: There are problems with (c):  
(c) Both parentheses have backslashes on this line.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/codinghorror/32/4242_2.png) [@codinghorror](https://boards.straightdope.com/u/codinghorror)\
**Post date:** [October 25, 2020, 5:16am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/9 "2020-10-25T05:16:01Z")

</div>

Let me teach you another trick, just because I like y’all:

`https://boards.straightdope.com/raw/923748/8`

that says you posted

```nohighlight
But compare with post #3 above. See the problem there? Here it is again, abbreviated: There are problems with (c):
\(c\) Both parentheses have backslashes on this line.

```

Let’s experiment!

`\(c\) \(c\)`

produces

(c) (c)

which is fine

`\(c\) and \(c\)`

produces

(c) and (c)

also fine, and

`\(c\)`  
`\(c\)`

produces

(c)  
(c)

also fine, but

`(c)`  
`\(c\)`

produces

©  
©

So if the line immediately above contains a non-escaped version, the escaped version directly underneath dosn’t work? Yes, certainly a bug, but it’s _such_ a narrow range of problem that I even wonder how it was discovered??

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 25, 2020, 5:23am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/10 "2020-10-25T05:23:46Z")

</div>

There seem to be two bugs:  
(1) As you noted, escaping the left parenthesis without escaping the right parenthesis doesn’t work.  
(2) But also: If © or any of the others like ® or similar appear in a paragraph, then any other occurrences of any of those in the same paragraph, even with proper backslashing will appear as ©, ®, etc.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/codinghorror/32/4242_2.png) [@codinghorror](https://boards.straightdope.com/u/codinghorror)\
**Post date:** [October 25, 2020, 5:26am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/11 "2020-10-25T05:26:52Z")

</div>

OK let me be clear that I am on board with this being a bug for sure, but is this _really_ causing problems in actual posts? I feel like I’m being dragged through the streets of hypothetical-theoretical-potential-problem-town.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/codinghorror/32/4242_2.png) [@codinghorror](https://boards.straightdope.com/u/codinghorror)\
**Post date:** [October 25, 2020, 5:30am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/12 "2020-10-25T05:30:38Z")

</div>

> [@Senegoid](#):
>
> As you noted, escaping the left parenthesis without escaping the right parenthesis doesn’t work.

But this is not a bug. You’d need to escape both to expect it to work.

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 25, 2020, 5:36am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/13 "2020-10-25T05:36:52Z")

</div>

I don’t recall the specific posts where I’ve seen it, but I’ve definitely seen it several times, including in posts I’ve made and in posts that others have made.

It’s noticeable in making lists where (c) appears as a copyright symbol instead. But in what cases does this happen? Since it might be a bit uncommon for it to appear twice in one paragraph (except of course in paragraphs where we’re talking about copyright symbols), I’m thinking there must be other cases that cause this. How about, when I see it again, I’ll let you know. It’s not altogether uncommon.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/codinghorror/32/4242_2.png) [@codinghorror](https://boards.straightdope.com/u/codinghorror)\
**Post date:** [October 25, 2020, 5:42am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/14 "2020-10-25T05:42:15Z")

</div>

It is a very fine bug. I respect the effort that went into finding it and reporting it. I’m also impressed since I’ve never actually seen this one reported before, and it’s probably been around since the very first days of Discourse (that’d be 2013).

But we also do try to prioritize fixing things that have the most impact on real world usage, because like all open source software there is a _lot_ of breakage… figurative… conceptual… and actual.

We also strive to expend most of our effort building new stuff, new features, and enhancements. You can see the roadmap at [releases - Discourse Meta](https://meta.discourse.org/c/releases/30)

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 25, 2020, 5:45am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/15 "2020-10-25T05:45:06Z")

</div>

It’s fun watching you making edits to your post even as I’m reading it. When you edit a post, I see the change immediately right before my very eyes!

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/codinghorror/32/4242_2.png) [@codinghorror](https://boards.straightdope.com/u/codinghorror)\
**Post date:** [October 25, 2020, 5:45am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/16 "2020-10-25T05:45:41Z")

</div>

Fun is an explicit goal in Discourse, as well, so that’s good 🎉

Why would you hang out somewhere that you _weren’t_ having fun?

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 25, 2020, 5:46am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/17 "2020-10-25T05:46:32Z")

</div>

Cause my boss is paying me to?

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [October 25, 2020, 5:49am UTC](https://boards.straightdope.com/t/using-backslash-to-escape-has-buggies/923748/18 "2020-10-25T05:49:47Z")

</div>

> [@codinghorror](#):
>
> I respect the effort that went into finding it and reporting it. I’m also impressed since I’ve never actually seen this one reported before,

It’s also because I’m a (retired) programmer, and I had a long history of finding and sometimes precisely diagnosing (often subtle) bugs in other peoples’ programs without ever even seeing their source code.
