craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.27k stars 635 forks source link

Slug generated keeps some of the special characters accents #7828

Closed melissadoyon closed 3 years ago

melissadoyon commented 3 years ago

Description

When typing or copy-pasting in the Entry Title field content with special characters, the slug generated keeps the accents for some of them.

Steps to reproduce

  1. In the control panel create a new entry with the title "Éléphant"
  2. When entering the title, you will see the slug in the right hand side generated is "éléphant" when the result expected would be "elephant"
Capture d’écran, le 2021-04-23 à 14 41 52

*Note: Do not have this issue with a project currently on Craft version 3.6.3.

Additional info

brandonkelly commented 3 years ago

That’s expected, as non-ASCII characters are allowed in URLs.

If you wish to limit the automatically-generated slugs to ASCII characters, enable the limitAutoSlugsToAscii config setting in config/general.php.

'limitAutoSlugsToAscii' => true,
melissadoyon commented 3 years ago

It is indeed what I already have in my config. limitAutoSlugsToAscii is set to true. Therefore I would expect that this behaviour would not occur.

brandonkelly commented 3 years ago

Are you typing/pasting the non-ASCII characters directly into the Slug field? In that case the setting won’t apply. “Auto” refers to the auto-generated slugs that are created based on the entry title.

melissadoyon commented 3 years ago

No I am typing/pasting the non-ASCII characters into the Title field.

brandonkelly commented 3 years ago

Sorry, I see what you mean now. Able to reproduce…

brandonkelly commented 3 years ago

Fixed now for the next release. Sorry about the confusion, and thanks for the report!

melissadoyon commented 3 years ago

Amazing! Thank you and you're welcome!!

brandonkelly commented 3 years ago

Craft 3.6.12.1 is out now with the fix for this. Thanks again!

vitalijalbu commented 1 year ago

Hi, how it will be in craft4? ->limitAutoSlugsToAscii(true) Because i added it, and if i edit the slug with special accents or characters, it still keeps them

i-just commented 1 year ago

@vitalijalbulimitAutoSlugsToAscii only applies to auto-generated slugs: https://craftcms.com/docs/4.x/config/general.html#limitautoslugstoascii. Nothing stops a user from amending the slug to contain non-ASCII characters.