Fixing the Nbsp Bug: Why   Turns into *

  • Thread starter Hurkyl
  • Start date
In summary, the non-breaking space in unicode doesn't work in IE, but it does in other word processors.
  • #1
Hurkyl
Staff Emeritus
Science Advisor
Gold Member
14,981
26
Ack! Stupid non breaking spaces!

I found a bug:

Suppose I include a non-breaking space (& nbsp ;) into one of my posts, such as the one seen here: →   .

Now, I follow this procedure:

I edit the post, and then submit it without any changes.

The nonbreaking space turns into an asterisk, as shown here: → * .

(I applied this procedure to this post, BTW, though I re-entered the code for the first nonbreaking space)
 
Physics news on Phys.org
  • #2
ExperimentExperimentExperimentExperimentExperiment5 ExperimentExperimentExperimentExperiment9Experiment10ExperimentExperiment12 ExperimentExperiment
 
Last edited:
  • #3
honestrosewater said:
Experiment.................. ... ...
Maybe & #160 ; works. Yes, it seems to work, but the source code still looks funny. Hm, apparently it doesn't work. Okay, well, it at least stays a space- I just can't tell if it breaks or not- spaces are put in automatically for some reason.? Okay, it works the first time, but afterward shows up as a regular space.

I remember having a similar problem with some other code, but I can't remember what it was. Anywho, I don't know if the non-breaking space in unicode is different, but using the unicode code fixed the problem before, even though unicode doesn't automatically work in IE (of course :rolleyes: ).
 
Last edited:
  • #4
What the hell is a 'non-breaking space'?
(Sorry, but you 2 seemed way too content just being off in this thread by yourselves.)
 
  • #5
Danger said:
What the hell is a 'non-breaking space'?
(Sorry, but you 2 seemed way too content just being off in this thread by yourselves.)
Good, I was feeling rather lonely here. I suspect you already know (aren't you a writer?), but a non-breaking space just doesn't allow a line break. :rolleyes: If I want to type O U C H ! but don't want part of it to end up getting wrapped to the next line, like O U C
H ! , then instead of putting normal spaces between each letter, I put non-breaking spaces between each letter so they all stay on the same line. :smile:
 
Last edited:
  • #6
Danger: Try   putting   lots   of   space   between   words   like   this.
 
  • #7
Hurkyl said:
Danger: Try putting lots of space between words like this.
If that's what you want to do, in the meantime, you can use white text, like------so.
 
  • #8
or you could just use the
[ code ]

[ /code ]

tags
 
  • #9
honestrosewater said:
Good, I was feeling rather lonely here. I suspect you already know (aren't you a writer?), but a non-breaking space just doesn't allow a line break. :rolleyes
Nope. Sorry. The only word processors that I've used are Atariwriter and Word Perfect 5 (and TED, about 25 years ago when I used to sneak into the basement of the Math building at U of C and steal a few hours on Multix in the middle of the night). As far as I know, none has that feature. The closest that I'm familiar with is a code which suppresses auto-hyphenation on a by-the-word basis. My beloved WP5 won't run on my even-more beloved Mac, so I'm stuck with MS Word. Unfortunately, since it came with the computer I don't have a manual. I've wondered about it a bit on this thing that we're using right now, because I get quite irritated when a smilie ends up on a line by itself. Are there instructions for this somewhere?
 
  • #10
Danger said:
Nope. Sorry. The only word processors that I've used are Atariwriter and Word Perfect 5 (and TED, about 25 years ago when I used to sneak into the basement of the Math building at U of C and steal a few hours on Multix in the middle of the night). As far as I know, none has that feature. The closest that I'm familiar with is a code which suppresses auto-hyphenation on a by-the-word basis. My beloved WP5 won't run on my even-more beloved Mac, so I'm stuck with MS Word. Unfortunately, since it came with the computer I don't have a manual. I've wondered about it a bit on this thing that we're using right now, because I get quite irritated when a smilie ends up on a line by itself. Are there instructions for this somewhere?
I've only used Word and found it adequate. I sort of even like Word. :redface: I don't know if you're asking about Word or PF, so...
To insert a non-breaking space in Word, click on the Insert menu > select Symbol > click the Special Characters tab > highlight nonbreaking space in the list > click the Insert button. There are various shortcuts if you use it often.

To insert a non-breaking space in PF, I guess there's at least two options.
You can type & # 1 6 0 ; without the spaces wherever you want the space to appear.
For example:
witty remark& # 1 6 0 ;:smile:
Result:
witty remark :smile:
But the non-breaking space turns into a regular space when it's "cycled through" or whatever a second time, as when you edit, preview, or quote.
A little more trouble, but would always work- type [color = white]-[/ color] without the spaces wherever you want the space to appear.
For example:
witty remark[color = white]-[/ color]:smile:
Result:
witty remark-:smile:
 
Last edited:
  • #11
honestrosewater said:
I've only used Word and found it adequate. I sort of even like Word. :redface:
We all have our shameful secrets. :tongue:
Thanks for the tips, Rosie. It was PF that I was asking about, but the info about Word will probably come in handy some time.
 
  • #12
honestrosewater said:
I've only used Word and found it adequate. I sort of even like Word. :redface: I don't know if you're asking about Word or PF, so...
To insert a non-breaking space in Word, click on the Insert menu > select Symbol > click the Special Characters tab > highlight nonbreaking space in the list > click the Insert button. There are various shortcuts if you use it often.

To insert a non-breaking space in PF, I guess there's at least two options.
You can type & # 1 6 0 ; without the spaces wherever you want the space to appear.
For example:
witty remark& # 1 6 0 ;:smile:
Result:
witty remark :smile:
But the non-breaking space turns into a regular space when it's "cycled through" or whatever a second time, as when you edit, preview, or quote.
A little more trouble, but would always work- type [color = white]-[/ color] without the spaces wherever you want the space to appear.
For example:
witty remark[color = white]-[/ color]:smile:
Result:
witty remark-:smile:

None of the codes anyone has suggested have ever worked for me from a Mac. I'll give yours a try though. For some reason, PF doesn't "see" the code the same when it's sent from my mac as when it is sent from a     PC. (I just inserted three spaces before "PC" with the code you listed above...lets see if they appear as nothing or as question marks or asterisks, or *gulp* spaces!).
 
  • #13
Moonbear said:
None of the codes anyone has suggested have ever worked for me from a Mac. I'll give yours a try though. For some reason, PF doesn't "see" the code the same when it's sent from my mac as when it is sent from a PC. (I just inserted three spaces before "PC" with the code you listed above...lets see if they appear as nothing or as question marks or asterisks, or *gulp* spaces!).
Woo hoo! They're spaces! Or they are for me. But "a---PC" should have stayed on the same line. :frown:
I don't know very much about the whole thing. I just learned enough to write some html and xhtml. Every character has a numeric code and some have name codes (ex. nbsp, amp). If you need or want to use the code, you enclose it in an ampersand and semicolon: & nbsp ;. If it's a numeric code, you put a hash in front of the numbers: & # 160 ;. But there are different character sets, so it gets more complicated. :yuck: Plus, on PF, the text in the text box goes through other doohickies that I know nothing about. :)

But I can still write "Moonie" in ISO-8859-1, using the numberic codes. M-77, o-111, n-110, i-105, e-101: Moonie. It should work for you too.

If you're running Windows, you can use the Character Map (Start > Programs > Accessories > System Tools > Character Map).
 
  • #14
Yep, they're spaces for me too :biggrin:, but "a      PC" ended up in the middle of a line for me, so I couldn't see if it would break or not. That's okay, I don't often need non-breaking spaces, but sometimes just being able to add extra spaces is something I want to do for emphasis or to get something aligned correctly.
 

1. Why does the   character turn into an asterisk?

The   character is a non-breaking space in HTML, meaning it prevents line breaks from occurring in between words. However, some text editors and browsers may interpret it as a multiplication sign, which is represented by an asterisk. This is not a bug, but rather a difference in interpretation.

2. How does this affect the appearance of my webpage?

If the   character is interpreted as an asterisk, it will appear as a multiplication sign on your webpage. This may disrupt the flow of your text and make it harder to read. It is important to use the correct character to avoid this issue.

3. Can I fix this issue myself?

Yes, you can fix this issue by manually replacing the   character with the correct non-breaking space character in your HTML code. Alternatively, you can use the HTML entity   to represent the non-breaking space, which will not be misinterpreted as an asterisk.

4. Is there a reason why some browsers interpret   as an asterisk?

The interpretation of the   character as an asterisk is not specific to one particular browser. It is a result of how different software programs interpret and display different characters. This is why it is important to use the correct character or HTML entity in your code.

5. How can I prevent this issue from occurring in the future?

To prevent this issue, it is important to use the correct character or HTML entity for a non-breaking space in your code. It is also helpful to use a text editor or browser that properly displays HTML characters to avoid any misinterpretation. Regularly checking and editing your code can also help to prevent this issue from occurring.

Similar threads

  • High Energy, Nuclear, Particle Physics
Replies
5
Views
1K
  • General Math
Replies
1
Views
1K
  • Computing and Technology
Replies
25
Views
3K
Replies
9
Views
962
  • Beyond the Standard Models
Replies
14
Views
3K
  • Special and General Relativity
Replies
20
Views
791
  • Beyond the Standard Models
Replies
0
Views
483
  • Feedback and Announcements
Replies
21
Views
2K
  • Programming and Computer Science
Replies
3
Views
3K
  • Beyond the Standard Models
Replies
0
Views
989
Back
Top