Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Space or Soft Hyphens

by BigLug (Chaplain)
on Feb 17, 2003 at 05:00 UTC ( #235887=monkdiscuss: print w/ replies, xml ) Need Help??

When the Chatterbox gets long words (normally URLs) it inserts spaces at intervals through the word. The HTML4.0 standard includes a 'soft hyphen' which would be a better option than the space. A soft hyphen is represented by '­'.

Unfortunately, this hyphen has different behaviour in different browsers. Not all of them follow the W3 recomendation at http://www.w3.org/TR/REC-html40/struct/text.html (see 9.3.3). However it would still be a better option than a space.

Some browsers will render the soft-hyphen as a hard-hyphen: It always shows a hyphen at the point where the ­ is inserted. This is incorrect, however it's just as good as a space because all browsers will automagically wrap after a hyphen.

Better browsers who follow the specs will only show the hyphen if it needs to wrap the line at that point. This makes it excellent for inserting into our CB text.

Not sure if your browser works? Well neither am I! If you see a hyphen in the middle of the following line then your browser will always show a hyphen. If nobody has mentioned your browser already, consider replying and letting me know if you get a hyphen or not. Ready for it? OK here comes:
This­Is­A­Really­Long­Word
If that looks like This-Is-A-Really-Long-Word then you're getting the hyphens. If it looks like ThisIsAReallyLongWord then you only get hyphens if they're needed.

Other than telling me what your browser does, what do you think of using them in the ChatterBox rather than spaces? It would make things look neater for (most|some) people and I imagine it would be a very simple patch for the pmdevs.

MacOS 9.22, Explorer 5.0 -> always hyphenates.
MacOS 9.22, Opera 6.0 -> hyphenates only when it needs to.

Comment on Space or Soft Hyphens
Re: Space or Soft Hyphens (see code wrap)
by tye (Cardinal) on Feb 17, 2003 at 06:02 UTC

    We already use soft hyphens for wrapping code if you select "Auto code wrapping" in user settings. No, it doesn't work in all browsers.

    What your test code doesn't check is whether the soft hyphens actually allow stuff to wrap. That would be the show stopper for using them always. If you view this node directly, then you can see my test for that aspect of things.

    It would make sense to have a user setting for using soft hyphens instead of spaces for the chatterbox nodelet. Not really a big concern for me, personally, though.

    Also note that using soft hyphens will result in more cases of people being confused when they cut'n'paste from chatter and don't get what they saw.

                    - tye
      OK, you've made sense ... seems my browser not only doesn't implement the W3C's recommendation but thinks of a soft-hyphen as a non-breaking hyphen! Which makes it even worse than useless. Please ignore my suggestion :)
Re: Space or Soft Hyphens
by Coruscate (Sexton) on Feb 17, 2003 at 07:42 UTC

    Let me see... running RedHat Linux, I tried Mozilla 1.01, Opera 6.11, Konqueror 3.0.3-14 (no, I never use Konqueror: I just tested every browser I have), and lynx 2.8.5dev.7. The results:

    • Mozilla: In your little example, I don't see hyphens. In tye's example, I don't see any hyphens, yet the text does not wrap. So: Mozilla doesn't do it right.

    • Opera: Exact same results as Mozilla, no difference whatsoever. So: Opera doesn't do it right.

    • Konqueror: In both your and tye's tests, Konqueror displays those little "I-don't-understand-that-character" little box and doesn't even begin to work in either case.

    • Lynx: Imagine this: lynx, against Mozilla, Opera, and Konqueror, is the __only__ browser that handled this the right way. In your example, I see no hyphens at all. In tye's example, not only does it wrap, its shows the hyphens in the right spots: only at the end where it wraps. So lynx got one thing working nicely at least :)

    The verdict: don't make it an enforced "feature", add it to user settings if you want but don't make it the default setting. Unless linux browsers smarten up and get with the times, I won't ever be using this option :)


    If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, reply to this node or /msg me to tell me what is wrong with the post, so that I may update the node to the best of my ability. If you do not inform me as to why the post deserved a downvote, your vote does not have any significance and will be disregarded.

Re: Space or Soft Hyphens
by demerphq (Chancellor) on Feb 17, 2003 at 16:04 UTC

    For the record IE 6 handles this correctly. (Including tyes test.)

    ---
    demerphq


Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://235887]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2014-11-23 09:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (129 votes), past polls