5
\$\begingroup\$

I wrote a solution to a code golf challenge that included the string ".... ....". This exact number of dots and spaces was necessary for the solution to work.

Two users commented (here, here) on ways to golf it down. I tested their suggestions and found that they didn't work. Initially I thought the users were confused; Then I tried to write a comment:

@User That doesn't work; Did you mean for the string to be ".... ...."?

And it rendered as:

@User That doesn't work; Did you mean for the string to be ".... ...."?

Is this intentional? If so, why? It has surely caused problems like this before. However, it looks like a bug to me. In posts, multiple spaces in backtick code blocks render as expected.

\$\endgroup\$
  • 1
    \$\begingroup\$ I can reproduce this behavior in the formatting sandbox: meta.stackexchange.com/questions/3122/formatting-sandbox/… \$\endgroup\$ – DJMcMayhem May 15 '17 at 19:20
  • 1
    \$\begingroup\$ I can also find unexpected behaviour with the character counter: puu.sh/vR0qt/db6bb5a889.png \$\endgroup\$ – Okx May 15 '17 at 19:23
  • 2
    \$\begingroup\$ This was fixed almost 8 years ago, but it seems to be back now. Since this seems to be a network wide problem, I have brought up the issue again here. \$\endgroup\$ – DJMcMayhem May 15 '17 at 19:34
  • 1
    \$\begingroup\$ I use non-breaking spaces to get around this issue when I must. \$\endgroup\$ – ETHproductions May 15 '17 at 19:40
  • \$\begingroup\$ @ETHproductions Does that work in code blocks? \$\endgroup\$ – MD XF May 15 '17 at 19:41
  • \$\begingroup\$ You can't use  , you just have to copy-paste a raw non-breaking space from somewhere. I primarily use Windows, so I copy it from the Character Map program (it's the character after ~). Example: non-breaking    spaces   \$\endgroup\$ – ETHproductions May 15 '17 at 19:42
  • \$\begingroup\$ @ETHproductions Wow,▓just▓found▓my▓new▓favorite▓pastime.░That's░awesome. \$\endgroup\$ – MD XF May 15 '17 at 19:43
  • \$\begingroup\$ ....      .... alternating space and NBSP \$\endgroup\$ – Digital Trauma May 15 '17 at 21:01
  • 1
    \$\begingroup\$ I'm reading this on the mobile app and the spaces in the code blocks in the question are being "collapsed" too. \$\endgroup\$ – Shaggy May 16 '17 at 20:30
2
\$\begingroup\$

As a workaround, you can make each character a different type of space; e.g. alternate normal and non-breaking spaces:

<space><nbsp><space><nbsp>...

@edit: As @ETHproductions points out, simply use all non-breaking space.

The wikipedia article lists several entry methods in various environments.

\$\endgroup\$
  • \$\begingroup\$ ....      .... alternating space and NBSP \$\endgroup\$ – Digital Trauma May 15 '17 at 21:05
  • \$\begingroup\$ Or just use all NBSP's \$\endgroup\$ – ETHproductions May 15 '17 at 21:05
  • \$\begingroup\$ ....      .... All NBSP \$\endgroup\$ – Digital Trauma May 15 '17 at 21:06
  • \$\begingroup\$ @ETHproductions fair enough. It didn't seem to work for me before when I tried, but now it looks good. \$\endgroup\$ – Digital Trauma May 15 '17 at 21:06
  • 1
    \$\begingroup\$ Do we really need to use a workaround - couldn't we just get a bugfix? \$\endgroup\$ – MD XF May 15 '17 at 21:10
  • \$\begingroup\$ @MDXF it's now been reported here: meta.stackexchange.com/q/296038/310400 \$\endgroup\$ – numbermaniac May 16 '17 at 7:04
  • \$\begingroup\$ @numbermaniac Yeah, because DJMcMayhem posted that after reading this. \$\endgroup\$ – MD XF May 16 '17 at 16:22
  • \$\begingroup\$ @MDXF, it's not really a bug: it's a design flaw in HTML. As such any "bug fix" implemented by the website is really a workaround rather than a bug fix. \$\endgroup\$ – Peter Taylor Jul 15 '17 at 6:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .