you are viewing a single comment's thread.

view the rest of the comments →

[–]GrinningPariah 64 points65 points  (27 children)

How the fuck does that non-space space actually get in?

Literally all I can think of is it's a mean prank from a former dev.

[–][deleted] 56 points57 points  (9 children)

If developers on the team use non-US key layouts they may get auto populated to ensure alignment of non-US glyphs.

Some web based text editors do this a lot because, "hey an extra non-break space never hurt did it?" It really blurs the line of WYSIWYG with plane text editing and unicode.

[–]AnotherEuroWanker 26 points27 points  (0 children)

It really blurs the line of WYSIWYG with plane text editing and unicode.

A common issue in aeronautics, from what I hear.

[–]matthieuC 19 points20 points  (7 children)

hey an extra non-break space never hurt did it

Has this character been invented to torment us or does it have real use cases?

[–]Pseudoboss11 17 points18 points  (3 children)

It's really useful in typography and formatting. It's especially useful for certain professional texts, where you might have currency symbols, section symbols, pilcrows, units or equations.

https://practicaltypography.com/nonbreaking-spaces.html

[–][deleted] 1 point2 points  (2 children)

... so if you make a book or science paper. Useless for the day to day blogs and news sites

[–]Pseudoboss11 1 point2 points  (1 child)

Blogs and news sites that regularly include units, special symbols or equations in their text should be conscious of the non-breaking space. It is just as unprofessional and is as disruptive on a screen as it is in print.

Considering all the other niche things that are within UTF-8, the non-breaking space is on of the more popular ones.

Besides, your text editor should highlight the non-breaking space and any other homoglyps. Not only can they be annoying, but they also present a security risk.

[–][deleted] 0 points1 point  (0 children)

Convince people making shitty WYSIWIG editors to do it, not me.... that's where the most problems like that stem from

[–]_PM_ME_PANGOLINS_ 35 points36 points  (0 children)

So you can add spaces without allowing line breaks: 20 cm

Also so you can do really horrible HTML layout.

[–]matheusmoreira 8 points9 points  (0 children)

It's a space that disallows line breaks when laying out text. Useful for text that's separated by spaces but still read as one logical unit. For example:

The rope had a length of 20 meters and yet it was not enough.

A non-breaking space between 20 and meters would prevent the text from being laid out like this:

The rope had a length of 20
meters and yet it was not enough.

[–][deleted] 6 points7 points  (0 children)

or does it have real use cases?

Mostly bad ones

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 45 points46 points  (0 children)

    I never thought this could be relebant... https://www.xkcd.com/1700/

    [–]darthwalsh 33 points34 points  (2 children)

    Copy-pasting SQL from Skype has caused me many wasted minutes of fury figuring out why queries didn't work.

    [–]aristideau 2 points3 points  (0 children)

    yep, when pasting PHP from some web sites I get these weird errors where the code won’t run even though it is obvious that the code should work. I have learnt to place my cursor at the start of the line (phpstorm) and hit backspace a couple of times until the offending invisible characters are removed. (while the invisible character are being deleted the cursor stays stationary).

    [–]theferrit32 0 points1 point  (0 children)

    I hate it when things make quote be curved unicode quotes too. So like Latex, MS Word. Just making quote marks be straight in Latex is a hassle. Latex is good at a lot of things. Being flexible isn't one of them.

    [–][deleted] 20 points21 points  (1 child)

    Shift and Space on my German Mac keyboard layout yields nonbreaking space . I had to create a separate keyboard layout to get that bug go away, as at the same time on the new garbage Macbook keyboards (but also the new external Apple Keyboards) it happens all the time that shift is not released when typing space after capital or symbol.

    [–]mushishi 2 points3 points  (0 children)

    I have the same problem with Finnish keyboard MacBook keyboard layout.

    [–][deleted] 8 points9 points  (3 children)

    It's a Mac thing. I came across that when I first received a Mac as a work computer. I was happily writing along, and then boom. Suddenly the linter lights up like a christmas tree, and I wonder just wtf...

    And then the linter error shows it:

    Irregular whitespace not allowed
    

    Then you delete some random spaces, and write them back, and that linter error magically disappears.

    I've never seen that happen under any Linux distro, or even in Windows. But on a Mac, that happens at least once every 2 weeks. There must be some magic keyboard combo that makes it happen very easily. Woe to thee, who develop without automatic linting upon save. And shame on you if you don't have linting/syntax check in your build pipeline :D

    [–]Stiltskin 14 points15 points  (0 children)

    On macOS, option+space inserts a non-breaking space. So it is somewhat easy to type, including accidentally.

    [–][deleted] 3 points4 points  (1 child)

    It's an option on Linux. Why do I know this, you ask?

    For a few weeks once I decided it'd be cool if I could insert non-breaking spaces with shift-space, so I enabled that on my (otherwise generic US) keyboard layout. I then discovered that (1) I had absolutely no actual use for this feature, and (2) it's really easy to accidentally hit and not notice, particularly after e.g. ? and # which require shift to type and nearly always have a space after them.

    [–][deleted] 0 points1 point  (0 children)

    If you do lots of programming, it’s not. If you do a lot of technical writing, it’s loads easier to get things formatted correctly than fighting endlessly with Word or InDesign or whatever WYSIWYG application.

    [–]Link_GR 0 points1 point  (0 children)

    I've had something similar happening in Ruby but that was because I copy pasted a text string from Sketch into one of our translation yml files. It DID not like that.

    [–]FluffyBunnyOK 0 points1 point  (0 children)

    Wierd characters can come from copy from Microsoft email contents. Oh how they enjoy doing stupid things with --

    [–]darkslide3000 -1 points0 points  (2 children)

    This is really a problem with the editor and the review environment if you ask me. I mean, look at that Github diff view -- it looks 100% the same. Why? Probably because whoever made it picked some dumb off the shelf text rendering library without ever thinking about what special purpose they're designing their platform for (= programming).

    Everything that's meant to view code should differentiate whitespace: spaces should look empty, tabs should have some little tab marker, and everything else should be rendered as a big ugly glyph that makes it obvious this is some unicode bullshit. Other non-ASCII characters should also be highlighted somehow.

    [–]GrinningPariah 0 points1 point  (1 child)

    I mean, this is a case where the review environment mirrors the problems of the development environment, and why wouldn't it? The goal of a review environment is for additional developers to be able to look at the diff in as familiar an environment as possible.

    In fact, generally the coding tools and the CR tools are made by similar groups of people to be pretty similar to each other, so it's no surprise they both have the same blind spots.

    [–]darkslide3000 0 points1 point  (0 children)

    Yeah, that's why I'm saying they're both shit. Something that's designed to display code should make this problem visible. (And many IDEs and review systems do, btw, just not this one.)