muci muci
"be consistent."
 
PerlMonks

Space or Soft Hyphens

by BigLug (Chaplain)
 | log AltBlue out | AltBlue | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | Snippets | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Code | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

on Feb 17, 2003 at 07:00 EET ( #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
Send private /msg to BigLug
Re: Space or Soft Hyphens (see code wrap) [id://235897]
by tye (Archbishop) on Feb 17, 2003 at 08:02 EET
       

    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
[reply]
[/msg]
       
      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 :)
[reply]
[/msg]
Re: Space or Soft Hyphens [id://235908]
by Coruscate (Sexton) on Feb 17, 2003 at 09:42 EET
       

    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.

[reply]
[/msg]
Re: Space or Soft Hyphens [id://235995]
by demerphq (Chancellor) on Feb 17, 2003 at 18:04 EET
       

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

    ---
    demerphq


[reply]
[/msg]
[d/l]

Back to Perl Monks Discussion

XP Nodelet
You have 19 votes left today.?
Tick tock
Mon Aug 4 12:35:25 2008
Aug 04, 2008 at 19:35 EEST
Chatterbox
  • And 0 more, 1 archived

[Corion]: Heh - I'm encountering Writer's Block. I'm sitting at an empty database and don't know what to do :)

How do I use this? | Other CB clients
Approval Nodelet
node history
 FrontPage
Consider node:
Node Type: monkdiscuss [id://235887]
Approved by Corion
help ntc
Personal Nodelet

Edit | Add current node
Add to public  /  private pad
Find Nodes
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers
AltBlue
log AltBlue out
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Perl Buzz
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Planet Perl
Use Perl
Perl Directory
Perl documentation
CPAN
Random Node
Information
PerlMonks FAQ
What's New at PerlMonks(*)
Guide to the Monastery
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Free Nodelet

Please read the PerlMonks FAQ (or, at least, How do I post a question effectively?)

Edit Free Nodelet

Nodelet Nodelet

Top Bottom