7

I answered a question in StackOverflow. Soon after, I added code to the answer. After a few more edits, I copied some of the code and pasted it at the end, made some modifications, and it's part of the same block of code. However, when StackOverflow formats it, the code is not formatted as code.

The text in the actual answer which I edited is formatted perfectly, four spaces in front of every line. However, it's formatted as plain text instead.

This happened in my answer to this question:

Need to Identify the Database name in an ODBC DSN connected application

5
  • Tim is faster than I am
    – User.1
    Mar 2, 2013 at 2:14
  • Thanks for editing my answer and fixing the code Tim :D Mar 2, 2013 at 2:57
  • Any details about the browser/OS you were using? And you copied/pasted from the very same post? (As an aside: it's Stack Overflow, with a space.)
    – Arjan
    Mar 2, 2013 at 13:25
  • It was in Chrome on Windows 7 Pro, I copied a block of code already in the site and pasted it just below the block that I copied - doubling the size of the block. Mar 2, 2013 at 13:31
  • Did it also show wrong in the preview? If yes, can you still repeat the problem right now? And if yes twice: do you know enough about HTML and browser tools to comment to balpha's answer here? That would be helpful!
    – Arjan
    Mar 2, 2013 at 13:47

1 Answer 1

9

Hex editor revealed this for your 4 space indentation:

A0 20 A0 20

Looks like some Unicode Character 'NO-BREAK SPACE' (U+00A0) ended up in there, which didn't trigger the formatting, check the below markdown for a demo (hit "edit" to view):


    not code

code
8
  • 5
    It looks like a non-breaking space broke something! Why am I not surprised? Mar 2, 2013 at 2:18
  • Hmmm, interesting, and all I did was copy some code and paste it at the end of the existing code. Mar 2, 2013 at 2:18
  • +1 Great find. I'll accept this as soon as I see a confirmation from a StackExchange expert that this is truly the cause, unless you are... I really don't know who's who here... Mar 2, 2013 at 2:24
  • 1
    Unlike [main] there's really no pressure to accept answers here. I don't think you'll get another explanation, but you can feel free to change the question to a bug report if you feel it should be considered one.
    – user159834
    Mar 2, 2013 at 2:49
  • @JerryDodge You can easily test it - try replacing the non-break spaces with normal spaces.
    – cpast
    Mar 2, 2013 at 2:49
  • Since StackOverflow is my primary basis of access to StackExchange (among many other sites), I subconsciously abide by StackOverflow rules across all StackExchange sites, since the rules there are quite solid. Mar 2, 2013 at 2:52
  • 2
    @JerryDodge You have much to learn about Meta. ;)
    – user159834
    Mar 2, 2013 at 2:54
  • @Jerry, please see balpha's answer at Why do code blocks sometimes not "show" properly?, and comment to that if you have some helpful information.
    – Arjan
    Mar 2, 2013 at 8:06

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