8

I've been having trouble with a Capistrano script, or in fact, a bash command that was causing my script to fail. I kept on getting errors from the script saying:

No such file or directory

So here's the script bit.

run "sudo ln -s #{shared_path}/readme.txt  #{shared_path}/readme-symlink.txt"

Upon closer inspection it turns out that there are two spaces between the readme.txt and readme-symlink.txt bits. By accident I found that one is a space, and the other is just a weird character that looks like a space, but it's not. Here's what it looks like in Sublime Text, configured to display whitespace:

weird whitespace character

Notice how, in the above image, there is only one dot after readme.txt, and then another "space"

So here's my question, what on earth is this charachter, I'm just so confused how someone managed to get that in there by typing on a normal keyboard?

4
  • 1
    It's definitely a space according to what you have pasted echo -n "t #" | hexdump.
    – alex
    Mar 22, 2013 at 8:06
  • @alex You're right, it is a space, see my answer, it's the type of space that broke the script... ;) Mar 22, 2013 at 8:20
  • Somewhere that non-breaking space was transformed into a regular space when you pasted it into the question.
    – alex
    Mar 22, 2013 at 8:22
  • Must be StackOverflow cleaning up the question text, I figured that might happen, so that's why I also pasted the graphic. Mar 22, 2013 at 8:23

1 Answer 1

10

So I pasted the string at http://www.asciivalue.com/index.php, the second space has an ASCII value of 160. According to http://www.ascii-code.com/ this is a space, but it's a non-breaking space, which I believe, the command line isn't too happy about.

enter image description here

Removing the nbsp fixes my script, and I can go on with my life again.

I'm just stumped about how the person that created the file got a nbsp in there in the first place.

7
  • And funny enough, the Capistrano script file is LITTERED with occurrences of normal spaces followed by non-breaking spaces. WTH!!! Mar 22, 2013 at 8:22
  • It's trivial to put any character in a string. It doesn't need to exist on the user's keyboard to put it there (they can copy and paste it, or use the character code for it).
    – alex
    Mar 22, 2013 at 8:23
  • Most likely, the script was copied from a webpage. Its use is explained here. sightspecific.com/~mosh/www_faq/nbsp.html
    – akaya
    Mar 22, 2013 at 8:24
  • @alex I agree, but who in their right mind copies and pastes a space followed by nbsp when they can just give the spacebar a good smack. ;) Mar 22, 2013 at 8:25
  • 2
    Hey thanks to the information found in this question/answer and other on the same subject we've wrote a funny post about it! I dare you to read it! :-D heavydots.com/blog/when-the-white-space-became-a-beast Jan 5, 2017 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.