What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

In chat conversations, my name appears as "Pierre-" when it should be "Pierre-Antoine" or at very least "Pierre".

share|improve this question

1 Answer 1

up vote 11 down vote accepted

Your name doesn't necessarily appear as "Pierre-"; that depends on the width of your browser window (and other issues like the font your browser uses, it's rendering engine, etc.)

These three screenshots of the same message were taken with no change other than changing the width of the window:

user name in chat with different window widths

In Chrome 8 on my Windows 7 box, your user name appears as "Pierre-Antoine" in live chat when the window is about 1470 pixels wide.

Another thing to note is that there are actually two versions of your signature. If there's enough space (e.g. because you said several things in a row), you'll instead get this version:

larger signature in chat

– and in this case, it's clearly correct that the hyphen is on the first line.

Both versions of the signature use the browser's line breaking algorithm to determine what to show – in case of the small signature, everything but the first line is just hidden away from display.

So what to do? Unicode to the rescue!

We now consider a dash* in a username that is preceded and followed by neither another dash nor a whitespace character to be a hyphen, and we replace this dash with the corresponding unicode character.

  • In the large signature, we use the regular hyphen, ‐. This doesn't change any line-breaking behavior, but is just for typographical consistency – a hyphen looks a little bit different from a regular dash, and we want the small and large versions of the signature to look equal.
  • In the small signature, we instead use the sequence ​‑. This is a zero-width space, followed by a non-breaking hyphen. This little trick does exactly what we want – it puts the line break before, not after the hyphen.

And behold**:

Pierre without hyphen

* The correct name is actually Hyphen-Minus, codepoint U+002D – typographically speaking, a dash is a totally different beast.
** Note that we currently only do this in the live chat, not in the transcript.

share|improve this answer
1  
Fine work, and good presentation!. –  Pëkka Jan 15 '11 at 11:03
    
Pedantically for true typographical consistency in your answer your punctuation dash should be a horizontal bar (U+2015) or an m-dash (U+2014), the latter being much easier of course (—). –  Richard Jan 15 '11 at 11:34
    
@Richard: This is actually debated, which is why I tend to go with the spaced n-dash (being what I'm used to from German). –  balpha Jan 15 '11 at 11:43
    
@balpha: German, hmmm :-). Just because some people have the wrong approach doesn't mean giving up the fight :-) Arguably, as the right here is an expansion/explanation of the left it should be a colon. –  Richard Jan 15 '11 at 12:15
    
@balpha: More seriously, U+2110 Hyphen (i.e. &#8208) appears to be missing from several of the fonts in MSO's (and I assume SO's) style sheet: Arial,Liberation Sans,DejaVu Sans,sans-serif. Certainly it isn't in Arial. Depending on the browser and OS some other glyph is going to be selected, perhaps without the line breaking behaviour you want. –  Richard Jan 15 '11 at 12:26
    
I didn't realize the browser width was the issue as I was seeing people with longer names than mine appearing. Makes sense now. Thanks guys :) –  plafayette Jan 17 '11 at 23:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .