Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
As mentionned in https://www.drupal.org/project/pathauto/issues/2039273, the module should not start by transliteration. In French, it remove the "Registered" icon and replace it with a "r", making it impossible to clean our URL properly.
By switching the "punctuation" step with the "transliteration" step, we could act on those special characters before Drupal eats them.
Comment | File | Size | Author |
---|---|---|---|
#10 | pathauto_change_punctuation_priority-2979476-10.patch | 4.12 KB | DuaelFr |
| |||
#9 | pathauto_change_punctuation_priority-2979476-9-test-only.patch | 2.85 KB | DuaelFr |
Comments
Comment #2
arakwar CreditAttribution: arakwar commentedHere's the patch.
Comment #3
idebr CreditAttribution: idebr at iO commentedComment #4
DuaelFrThe patch applies cleanly, is simple and fixes the issue. Thanks!
There is just a nitpick that could be fixed on commit (new line with leading spaces).
Comment #5
BerdirHm, is there possibly a use case that would be affected by changing this? Would be nice to have explicit test coverage for this somehow, so that it is clear why the order is like this in case someone tries to change it.
Comment #6
arakwar CreditAttribution: arakwar commented@Berdir
While having "Transliterate prior to creating alias" active, put a ® in a node title and use the node title in your pattern then process the pattern.
This option is used to remove à,è,é and others from URL and replace them by US-ASCII characters, but it also get the "Registered" sign in it.
I'll try to figure out how to adjust test for this, you're right, it need to be tested in case someone changes it.
Comment #7
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedSounds like this is NW then :)
Comment #8
DuaelFrI've found a new use case.
Some special characters are transliterated into other special characters. For example, strange quotes from Word are transliterated into common quotes. The thing is that if we have configured quotes to be replaced in the punctuation settings, these converted quotes won't be replaced.
Here is a specific example given we have added "®" to the punctuation list to remove it from the alias:
Test ® with “strange quotes”
test-with-strange-quotes
test-r-with-strange-quotes
test-(r)-with-"strange-quotes"
The problem comes from the transliteration that sometimes replace special characters by other special characters.
The only way I see to prevent this to happen would be to clean punctuation before AND after the transliteration process.
Comment #9
DuaelFrI tried to expand the test coverage to illustrate the issue and the fix as told in the previous comment.
Comment #10
DuaelFrI uploaded twice the test only patch...
This one is the good one.
Comment #13
BerdirThe double replace is a bit unfortunate but not a real performance issue, thanks for the tests. Resolved a simple conflict on commit.