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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arakwar created an issue. See original summary.

arakwar’s picture

idebr’s picture

Status: Active » Needs review
DuaelFr’s picture

Status: Needs review » Reviewed & tested by the community

The 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).

Berdir’s picture

Hm, 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.

arakwar’s picture

@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.

amateescu’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Sounds like this is NW then :)

DuaelFr’s picture

I'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:

  • String to convert: Test ® with “strange quotes”
  • Expected result: test-with-strange-quotes
  • Current result: test-r-with-strange-quotes
  • #2 patch result: 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.

DuaelFr’s picture

I tried to expand the test coverage to illustrate the issue and the fix as told in the previous comment.

DuaelFr’s picture

I uploaded twice the test only patch...
This one is the good one.

The last submitted patch, 9: pathauto_change_punctuation_priority-2979476-9-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

The last submitted patch, 9: pathauto_change_punctuation_priority-2979476-9.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Berdir’s picture

Status: Needs review » Fixed

The double replace is a bit unfortunate but not a real performance issue, thanks for the tests. Resolved a simple conflict on commit.

  • Berdir committed b65a7e8 on 8.x-1.x authored by DuaelFr
    Issue #2979476 by DuaelFr, arakwar, Berdir: Remove the punctuation...

  • Berdir committed ba1f169 on 8.x-1.x
    Issue #2979476 by Berdir: Fix new test module info.yml for D9...

Status: Fixed » Closed (fixed)

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