[buddypress-trac] [BuddyPress Trac] #6254: Chunk of Unicode text does not show any excerpt in BP activity stream at all

buddypress-trac noreply at wordpress.org
Wed Feb 25 14:11:05 UTC 2015


#6254: Chunk of Unicode text does not show any excerpt in BP activity stream at
all
--------------------------+------------------
 Reporter:  rosyteddy     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  2.3
Component:  Not sure      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  2nd-opinion   |
--------------------------+------------------
Changes (by boonebgorges):

 * keywords:  reporter-feedback => 2nd-opinion
 * milestone:  Awaiting Review => 2.3


Comment:

 Thanks all. Just to reiterate: I don't think this issue has anything to do
 with Unicode or character sets in particular. Any unbroken 226+ character
 sequence at the beginning of an activity excerpt will produce the same
 thing.

 DJPaul - Thanks for the reminder about CakePHP. Here's their `truncate()`
 method that we stole from
 https://github.com/cakephp/cakephp/blob/d21b046fc829e46cb6b7f103034b71fc78d9a192/lib/Cake/Utility/String.php#L519.
 It appears that the behavior described here - that when `exact=false`, an
 initial word longer than `$length` will result in a zero-length excerpt -
 is actually expected behavior. Here's their test:
 https://github.com/cakephp/cakephp/blob/d21b046fc829e46cb6b7f103034b71fc78d9a192/lib/Cake/Test/Case/Utility/StringTest.php#L470

 IMO, the fix that makes sense is to add a special case to
 `bp_create_excerpt()` that will detect when an excerpt would be trimmed to
 zero-length due to this issue, and if so, to essentially force
 `exact=false`. So `foo...barbaz`, a 226-character string, will be
 truncated to `foo...barba […]`. This will result in mid-word
 truncation in these cases, but it's probably better than the current
 behavior. The only question is whether this should be default behavior,
 and if so, whether it should be configurable - ie, do we need a new value
 of 'exact' that would be something like 'nonempty', and should it be the
 default?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6254#comment:5>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list