Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird space character in string, that's not a space?

Tags:

ascii

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?

like image 497
josef.van.niekerk Avatar asked Mar 22 '13 08:03

josef.van.niekerk


1 Answers

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.

like image 96
josef.van.niekerk Avatar answered Sep 20 '22 18:09

josef.van.niekerk