There's some new changes in D7's truncate_utf8() function that uses a more advanced truncation method. We should update our method to synchronize with it. And we can add some unit tests for the function.

Comments

dave reid’s picture

Title: Update _pathauto_truncate_chars() to match truncate_utf8() » Replace _pathauto_truncate_chars() with truncate_utf8()

Actually, we can just replace _pathauto_truncate_chars() to use truncate_utf8() itself! The D7 version of the function has been improved and works just great with URL aliases.

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new2.49 KB

Patch for review.

greggles’s picture

afaik truncate_utf8 in d7 core was worked on by Freso because of his frustration with how the D7 version worked for the needs of Pathauto. It's not surprising that it's so easy to flip them out.

Though I haven't tested it, makes sense to me.

dave reid’s picture

Status: Needs review » Fixed

Tested thoroughly here and it's working great. Committing to CVS!
http://drupal.org/cvs?commit=388256

dave reid’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev
Status: Fixed » Patch (to be ported)

Ideally I'd like to backport this to 6.x-2.x as well.

dave reid’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new8.9 KB

Patch backporting the truncate_utf8() to D6.

dave reid’s picture

StatusFileSize
new11.69 KB

Patch including tests

dave reid’s picture

Status: Needs review » Fixed

Patch passes tests, so committing to CVS.
http://drupal.org/cvs?commit=388278

Status: Fixed » Closed (fixed)

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