Closed (fixed)
Project:
Drupal core
Component:
base system
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
21 Nov 2004 at 13:30 UTC
Updated:
6 Dec 2004 at 21:15 UTC
Modification to truncate_utf8() to support word boundary-aware chopping. The added parameter is a flag that defaults to FALSE.
An Example:
I wish I had sextants to use to navigate this sea
(Currently, you don't want to chop to 16 chars)
with word boundary-aware truncate, this will truncate to the nearest word boundary after the length:
I wish I had
This is also helpful when people post URLs as content. (otherwise we'd end up with wrong URLs)
| Comment | File | Size | Author |
|---|---|---|---|
| common.inc.patch.txt | 946 bytes | arnabdotorg |
Comments
Comment #1
arnabdotorg commentedComment #2
Steven commented- The code does not conform to the coding standards.
- It's not very flexible. A word boundary is more than just a space, it can be tons of characters.
- A string without spaces gets chopped to nothing. I'm not sure if this is desirable.
PS: Set the issue status correctly next time please.
Comment #3
arnabdotorg commentedCommitted to HEAD. [this is why this is fixed]
Comment #4
arnabdotorg commented- coding standards were fixed in the patch applied.
- yes, we could have a whole bunch of things for boundaries, but a space is the most "resilient", imho: (e.g. URLS, etc invalidate the use of ".", ":","/" as boundaries).
- I'd rather have correct information than mangled text.
But you're right, (2) and (3) are pretty subjective issues.
Comment #5
(not verified) commented