For as long as I can remember, truncate_utf8() has claimed that it has an option to add an ellipsis to a truncated string…

However, that is not what it does. Instead, it will add three dots (and in Drupal 6, even prefix them with a space, the horror).

There are many different conventions as to how to print an ellipsis with the characters on a normal keyboard, but since Drupal supports Unicode, we have the option of using the dedicated Unicode character for ellipsis, namely U+2026 or “…”.

The benefits is that … is much easier on the eyes than ..., it takes up less characters, carries a semantic meaning instead of just being a multiple of dots and it pleases those of us that are typographically inclined.

I’ve added a patch for this issue, and since it changes the output of truncate_utf8(), I’ve adjusted the tests accordingly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikl’s picture

Title: Use real ellipsis (…) instead of three dots (...) » Use ellipsis character (…) instead of three dots (...)
Status: Active » Needs review

Oh yes, please test.

moshe weitzman’s picture

We should make sure that our HTML => Plain Text converter does the right thing when it encounters this char.

mikl’s picture

#2: I’m not quite sure what this entails? More tests for check_plain(), filter_xss(), and drupal_validate_utf8()?

moshe weitzman’s picture

royerd’s picture

Indeed, this kind of drives me nuts. I'm in D6. Is there a way I can make this happen to my D6 install?

mikl’s picture

#5: No, there’s no way of changing it, short of hacking core… :-(

mikl’s picture

FileSize
6.38 KB

I’ve added some tests for drupal_html_to_text() that includes the ellipsis character. There were no pre-existing tests, so I’ve added a couple. I suppose there should be more thorough testing of that function, but that is beyond the scope of this ticket.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Excellent. Thanks for adding the tests.

Dries’s picture

Version: 7.x-dev » 8.x-dev
Priority: Normal » Minor

I'm going to postpone it to Drupal 8.

mikl’s picture

@Dries: Aww :(
Can we convince you to change your mind? The semantics of truncate_utf8() has been bugging me for ages…

royerd’s picture

TR’s picture

Still applies in Drupal 8.x. Let's see what the test bot has to say about it.

TR’s picture

#7: 2010-07-30-ellipsis.patch queued for re-testing.

catch’s picture

Issue tags: +Needs backport to D7

We should consider this for backport, should be entirely backwards compatible.

webchick’s picture

Issue tags: -Needs backport to D7

Sorry, I don't find this compelling enough to break translations in D7, considering how long this has been broken. Dries also explicitly moved this to D8 a year ago.

However, an easy workaround for this issue for D6/D7 sites would be the http://drupal.org/project/stringoverrides module.

Dries’s picture

2010-07-07-ellipsis.patch queued for re-testing.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

The tests passed in 2010 so I'm asking for a re-test.

Dries’s picture

Status: Fixed » Reviewed & tested by the community
catch’s picture

#7: 2010-07-30-ellipsis.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2010-07-30-ellipsis.patch, failed testing.

mikl’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
5.6 KB

Rerolled patch for the new core/* structure in D8. No code changes.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, ellipsis-847608-21.patch, failed testing.

mikl’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
5.44 KB

Re-roll.

webchick’s picture

-      array('Stop. Hammertime.', 16, 'Stop....'),
+      array('Stop. Hammertime.', 16, 'Stop.…'),

can we make that one just one ellipsis, and not an ellipsis and a period?

I can't commit this to D7, since it's a string change, but +1 from me. :)

webchick’s picture

Status: Reviewed & tested by the community » Needs work
mikl’s picture

#24:

can we make that one just one ellipsis, and not an ellipsis and a period?

Yeah, that should be a definite improvement. Here's a stab at that :)

mikl’s picture

Status: Needs work » Needs review
FileSize
5.7 KB

Ah, forgot the patch.

yoroy’s picture

Status: Needs review » Reviewed & tested by the community

I felt so awesome the day I found out about this character…

catch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! Committed/pushed to 8.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.